wwbmmm commented on code in PR #1806:
URL: https://github.com/apache/incubator-brpc/pull/1806#discussion_r901279400


##########
src/brpc/details/health_check.cpp:
##########
@@ -207,14 +210,14 @@ bool HealthCheckTask::OnTriggeringTask(timespec* 
next_abstime) {
         if (ptr->CreatedByConnect()) {
             g_vars->channel_conn << -1;
         }
-        if (!FLAGS_health_check_path.empty()) {
+        if (!_health_check_path.empty()) {
             ptr->_ninflight_app_health_check.fetch_add(
                     1, butil::memory_order_relaxed);
         }
         ptr->Revive();
         ptr->_hc_count = 0;
-        if (!FLAGS_health_check_path.empty()) {
-            HealthCheckManager::StartCheck(_id, ptr->_health_check_interval_s);
+        if (!_health_check_path.empty()) {
+            HealthCheckManager::StartCheck(_id, ptr->_health_check_interval_s, 
ptr->_health_check_path);

Review Comment:
   为什么一个是_health_check_path,一个是ptr->_health_check_path呢



##########
src/brpc/details/naming_service_thread.h:
##########
@@ -49,6 +49,7 @@ struct GetNamingServiceThreadOptions {
     bool succeed_without_server;
     bool log_succeed_without_server;
     ChannelSignature channel_signature;
+    std::string health_check_path;

Review Comment:
   是不是可以将health_check_path算到channel_signature里面。这样就不用到处修改SocketKey相关的代码



##########
src/brpc/details/health_check.cpp:
##########
@@ -119,16 +119,17 @@ void OnAppHealthCheckDone::Run() {
                 << " was abandoned during health checking";
         return;
     }
+    const std::string& hc_path = channel.options().health_check_path;

Review Comment:
   同上



##########
src/brpc/details/health_check.cpp:
##########
@@ -103,7 +103,7 @@ void HealthCheckManager::StartCheck(SocketId id, int64_t 
check_interval_s) {
 void* HealthCheckManager::AppCheck(void* arg) {
     OnAppHealthCheckDone* done = static_cast<OnAppHealthCheckDone*>(arg);
     done->cntl.Reset();
-    done->cntl.http_request().uri() = FLAGS_health_check_path;
+    done->cntl.http_request().uri() = 
done->channel.options().health_check_path;

Review Comment:
   建议从done的成员获取health_check_path
   而不是通过channel.options()



##########
src/brpc/details/health_check.cpp:
##########
@@ -69,19 +69,19 @@ class OnAppHealthCheckDone : public 
google::protobuf::Closure {
 
 class HealthCheckManager {
 public:
-    static void StartCheck(SocketId id, int64_t check_interval_s);
+    static void StartCheck(SocketId id, int64_t check_interval_s, std::string 
app_hc_path);
     static void* AppCheck(void* arg);
 };
 
-void HealthCheckManager::StartCheck(SocketId id, int64_t check_interval_s) {
+void HealthCheckManager::StartCheck(SocketId id, int64_t check_interval_s, 
std::string app_hc_path) {
     SocketUniquePtr ptr;
     const int rc = Socket::AddressFailedAsWell(id, &ptr);
     if (rc < 0) {
         RPC_VLOG << "SocketId=" << id
                  << " was abandoned during health checking";
         return;
     }
-    LOG(INFO) << "Checking path=" << ptr->remote_side() << 
FLAGS_health_check_path;
+    LOG(INFO) << "Checking path=" << ptr->remote_side() << app_hc_path;
     OnAppHealthCheckDone* done = new OnAppHealthCheckDone;
     done->id = id;
     done->interval_s = check_interval_s;

Review Comment:
   建议把app_hc_path写到done的成员里。



##########
src/brpc/input_messenger.h:
##########
@@ -83,6 +83,7 @@ class InputMessenger : public SocketUser {
     // [thread-safe] Create a socket to process input messages.
     int Create(const butil::EndPoint& remote_side,
                time_t health_check_interval_s,
+               const std::string& health_check_path,

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.

To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org

Reply via email to