Skip to content
Permalink
Browse files
rpc_view support setting timeout
  • Loading branch information
serverglen committed Jul 2, 2021
1 parent a4e28d6 commit dd7faed025f44f4e770b8066704226d3401d4f05
Showing 1 changed file with 2 additions and 1 deletion.
@@ -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 @@ class ViewServiceImpl : public ViewService {
// 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;
}

0 comments on commit dd7faed

Please sign in to comment.