From 7957e692466db0b7b83b7218602757113e9f2d22 Mon Sep 17 00:00:00 2001 From: windrunner123 Date: Wed, 24 Nov 2021 11:26:51 +0800 Subject: [PATCH] Fix bug for judging threshold --- sentinel-core/circuitbreaker/error_circuit_breaker.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sentinel-core/circuitbreaker/error_circuit_breaker.cc b/sentinel-core/circuitbreaker/error_circuit_breaker.cc index a45534eee..4478499fc 100644 --- a/sentinel-core/circuitbreaker/error_circuit_breaker.cc +++ b/sentinel-core/circuitbreaker/error_circuit_breaker.cc @@ -68,7 +68,7 @@ void ErrorCircuitBreaker::RecordAndHandleStateChange(const std::string& err) { double cur_value = strategy_ == Strategy::kErrorRatio ? err_count * 1.0 / total_count : err_count; - if (cur_value > threshold_) { + if (cur_value >= threshold_) { auto cs = current_state_.load(); switch (cs) { case State::kClosed: @@ -84,4 +84,4 @@ void ErrorCircuitBreaker::RecordAndHandleStateChange(const std::string& err) { } } // namespace CircuitBreaker -} // namespace Sentinel \ No newline at end of file +} // namespace Sentinel