@@ -57,8 +57,7 @@ class OnAppHealthCheckDone : public google::protobuf::Closure {
5757 SocketId id;
5858 int64_t interval_s;
5959 int64_t last_check_time_ms;
60- int32_t health_check_timeout_ms;
61- std::string health_check_path;
60+ HealthCheckOption hc_option;
6261};
6362
6463class HealthCheckManager {
@@ -79,13 +78,12 @@ void HealthCheckManager::StartCheck(SocketId id, int64_t check_interval_s) {
7978 OnAppHealthCheckDone* done = new OnAppHealthCheckDone;
8079 done->id = id;
8180 done->interval_s = check_interval_s;
82- done->health_check_timeout_ms = ptr->health_check_timeout_ms ();
83- done->health_check_path = ptr->health_check_path ();
81+ done->hc_option = ptr->_hc_option ;
8482 brpc::ChannelOptions options;
8583 options.protocol = PROTOCOL_HTTP;
8684 options.max_retry = 0 ;
8785 options.timeout_ms =
88- std::min ((int64_t )(done->health_check_timeout_ms ), check_interval_s * 1000 );
86+ std::min ((int64_t )(done->hc_option . health_check_timeout_ms ), check_interval_s * 1000 );
8987 if (done->channel .Init (id, &options) != 0 ) {
9088 LOG (WARNING) << " Fail to init health check channel to SocketId=" << id;
9189 ptr->_ninflight_app_health_check .fetch_sub (
@@ -99,7 +97,7 @@ void HealthCheckManager::StartCheck(SocketId id, int64_t check_interval_s) {
9997void * HealthCheckManager::AppCheck (void * arg) {
10098 OnAppHealthCheckDone* done = static_cast <OnAppHealthCheckDone*>(arg);
10199 done->cntl .Reset ();
102- done->cntl .http_request ().uri () = done->health_check_path ;
100+ done->cntl .http_request ().uri () = done->hc_option . health_check_path ;
103101 ControllerPrivateAccessor (&done->cntl ).set_health_check_call ();
104102 done->last_check_time_ms = butil::gettimeofday_ms ();
105103 done->channel .CallMethod (NULL , &done->cntl , NULL , NULL , done);
@@ -117,14 +115,14 @@ void OnAppHealthCheckDone::Run() {
117115 }
118116 if (!cntl.Failed () || ptr->Failed ()) {
119117 LOG_IF (INFO, !cntl.Failed ()) << " Succeeded to call "
120- << ptr->remote_side () << health_check_path;
118+ << ptr->remote_side () << hc_option. health_check_path ;
121119 // if ptr->Failed(), previous SetFailed would trigger next round
122120 // of hc, just return here.
123121 ptr->_ninflight_app_health_check .fetch_sub (
124122 1 , butil::memory_order_relaxed);
125123 return ;
126124 }
127- RPC_VLOG << " Fail to check path=" << health_check_path
125+ RPC_VLOG << " Fail to check path=" << hc_option. health_check_path
128126 << " , " << cntl.ErrorText ();
129127
130128 int64_t sleep_time_ms =
0 commit comments