Commit c05d3317 authored by yuanfeng's avatar yuanfeng

if setting disovery zone, fetching nodes api url will append zone info

parent 7a4393f0
...@@ -349,10 +349,14 @@ int DiscoveryNamingService::GetServers(const char* service_name, ...@@ -349,10 +349,14 @@ int DiscoveryNamingService::GetServers(const char* service_name,
} }
servers->clear(); servers->clear();
Controller cntl; Controller cntl;
cntl.http_request().uri() = butil::string_printf( std::string uri_str = butil::string_printf(
"/discovery/fetchs?appid=%s&env=%s&status=%s&zone=%s", service_name, "/discovery/fetchs?appid=%s&env=%s&status=%s", service_name,
FLAGS_discovery_env.c_str(), FLAGS_discovery_status.c_str(), FLAGS_discovery_env.c_str(), FLAGS_discovery_status.c_str());
FLAGS_discovery_zone.c_str()); if (!FLAGS_discovery_zone.empty()) {
uri_str.append("&zone=", 6);
uri_str.append(FLAGS_discovery_zone);
}
cntl.http_request().uri() = uri_str;
chan->CallMethod(NULL, &cntl, NULL, NULL, NULL); chan->CallMethod(NULL, &cntl, NULL, NULL, NULL);
if (cntl.Failed()) { if (cntl.Failed()) {
LOG(ERROR) << "Fail to get /discovery/fetchs: " << cntl.ErrorText(); LOG(ERROR) << "Fail to get /discovery/fetchs: " << cntl.ErrorText();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment