jamesge commented on a change in pull request #694: Health check by rpc call
URL: https://github.com/apache/incubator-brpc/pull/694#discussion_r268083443
 
 

 ##########
 File path: src/brpc/socket.cpp
 ##########
 @@ -1026,6 +1063,49 @@ bool HealthCheckTask::OnTriggeringTask(timespec* 
next_abstime) {
         }
         ptr->Revive();
         ptr->_hc_count = 0;
+        if (ptr->IsHealthCheckingUsingRPC()) {
+            brpc::ChannelOptions options;
+            options.protocol = "http";
+            options.max_retry = 0;
+            options.timeout_ms = FLAGS_health_check_timeout_ms;
+            HealthCheckChannel channel;
+            if (channel.Init(_id, &options) != 0) {
+                ptr->SetFailed();
+                ++ ptr->_hc_count;
+                *next_abstime = 
butil::seconds_from_now(ptr->_health_check_interval_s);
+                return true;
+            }
+            brpc::Controller cntl;
+            cntl.http_request().uri() = FLAGS_health_check_path;
+            cntl.set_health_check_call(true);
+            channel.CallMethod(NULL, &cntl, NULL, NULL, NULL);
 
 Review comment:
   这里不能阻塞

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to