Преглед на файлове

rpc_view support setting timeout

serverglen преди 2 години
родител
ревизия
dd7faed025
променени са 1 файла, в които са добавени 2 реда и са изтрити 1 реда
  1. 2 1
      tools/rpc_view/rpc_view.cpp

+ 2 - 1
tools/rpc_view/rpc_view.cpp

@@ -24,6 +24,7 @@
 
 DEFINE_int32(port, 8888, "TCP Port of this server");
 DEFINE_string(target, "", "The server to view");
+DEFINE_int32(timeout_ms, 5000, "Timeout for calling the server to view");
 
 // handle HTTP response of accessing builtin services of the target server.
 static void handle_response(brpc::Controller* client_cntl,
@@ -135,7 +136,7 @@ public:
         // query "seconds", we set the timeout to be longer than "seconds".
         const std::string* seconds =
             server_cntl->http_request().uri().GetQuery("seconds");
-        int64_t timeout_ms = 5000;
+        int64_t timeout_ms = FLAGS_timeout_ms;
         if (seconds) {
             timeout_ms += atoll(seconds->c_str()) * 1000;
         }