jiangyt-git commented on code in PR #2634: URL: https://github.com/apache/brpc/pull/2634#discussion_r1617205807
########## src/brpc/circuit_breaker.cpp: ########## @@ -188,6 +197,20 @@ bool CircuitBreaker::OnCallEnd(int error_code, int64_t latency) { if (_broken.load(butil::memory_order_relaxed)) { return false; } + if (FLAGS_circuit_breaker_half_open_window_size > 0 + && _half_open.load(butil::memory_order_relaxed)) { + if (error_code != 0) { + MarkAsBroken(); + return false; + } + if (_half_open_success_count.fetch_add(1, butil::memory_order_relaxed) + + 1 == FLAGS_circuit_breaker_half_open_window_size) { + _half_open.store(false, butil::memory_order_relaxed); + _half_open_success_count.store(0, butil::memory_order_relaxed); + return true; Review Comment: Done. -- 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