Commit 8b2edf4e authored by zhujiashun's avatar zhujiashun

health_check_using_rpc: refine comment

parent 084c1e7a
......@@ -325,7 +325,9 @@ public:
bool is_done_allowed_to_run_in_place() const
{ return has_flag(FLAGS_ALLOW_DONE_TO_RUN_IN_PLACE); }
// TODO(zhujiahsun): comment
// Tell RPC that this particular call is used to do health check. These two
// functions is used by the developers of brpc and should not be touched or
// called by users.
void set_health_check_call(bool f) { set_flag(FLAGS_HEALTH_CHECK_CALL, f); }
bool has_health_check_call() const { return has_flag(FLAGS_HEALTH_CHECK_CALL); }
......
......@@ -94,9 +94,12 @@ DEFINE_int32(connect_timeout_as_unreachable, 3,
"times *continuously*, the error is changed to ENETUNREACH which "
"fails the main socket as well when this socket is pooled.");
DEFINE_bool(health_check_using_rpc, false, "todo");
DEFINE_string(health_check_path, "/health", "todo");
DEFINE_int32(health_check_timeout_ms, 300, "todo");
DEFINE_bool(health_check_using_rpc, false, "By default health check succeeds if server"
"can be connected. If this flag is set, health check is completed not only"
"when server can be connected but also an additional http call succeeds"
"indicated by FLAGS_health_check_path and FLAGS_health_check_timeout_ms");
DEFINE_string(health_check_path, "/health", "Http path of health check call");
DEFINE_int32(health_check_timeout_ms, 300, "Timeout of health check call");
static bool validate_connect_timeout_as_unreachable(const char*, int32_t v) {
return v >= 2 && v < 1000/*large enough*/;
......@@ -1045,7 +1048,7 @@ bool HealthCheckTask::OnTriggeringTask(timespec* next_abstime) {
options.timeout_ms = FLAGS_health_check_timeout_ms;
brpc::Channel channel;
if (channel.Init(_id, &options) != 0) {
// SetFailed() again to trigger next round of health checking
// SetFailed to trigger next round of health checking
ptr->SetFailed();
return false;
}
......
......@@ -349,8 +349,12 @@ public:
void SetLogOff();
bool IsLogOff() const;
// TODO(zhujiashun)
// Check Whether the state is in health check using rpc state or
// not, which means this socket would not be selected in further
// user request until rpc succeed and can only be used by health
// check rpc call.
bool IsHealthCheckingUsingRPC() const;
// Reset health check state to the initial state(which is false)
void ResetHealthCheckingUsingRPC();
// Start to process edge-triggered events from the fd.
......@@ -795,8 +799,8 @@ private:
butil::Mutex _stream_mutex;
std::set<StreamId> *_stream_set;
// If this flag is set, then the current socket is used to health check
// and should not health check again
// If this flag is set, socket is now in health check state using
// application-level rpc.
butil::atomic<bool> _health_checking_using_rpc;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment