Commit d8893d43 authored by TousakaRin's avatar TousakaRin

fix codestyle

parent 5d440eb9
......@@ -180,11 +180,12 @@ void CircuitBreaker::Reset() {
_long_window.Reset();
_short_window.Reset();
_last_reset_time_ms = butil::cpuwide_time_ms();
_broken.store(false, butil::memory_order_release);
}
void CircuitBreaker::MarkAsBroken() {
if (_broken.exchange(true, butil::memory_order_acquire)) {
_isolated_times.fetch_add(butil::memory_order_relaxed);
if (!_broken.exchange(true, butil::memory_order_acquire)) {
_isolated_times.fetch_add(1, butil::memory_order_relaxed);
UpdateIsolationDuration();
}
}
......@@ -194,8 +195,8 @@ int CircuitBreaker::health_score() const {
}
void CircuitBreaker::UpdateIsolationDuration() {
int isolation_duration_ms = _isolation_duration_ms.load(butil::memory_order_relaxed);
int64_t now_time_ms = butil::cpuwide_time_ms();
int isolation_duration_ms = _isolation_duration_ms.load(butil::memory_order_relaxed);
const int max_isolation_duration_ms =
FLAGS_circuit_breaker_max_isolation_duration_ms;
const int min_isolation_duration_ms =
......
......@@ -33,12 +33,12 @@ public:
// latency: Time cost of this call.
// Note: Once OnCallEnd() determined that a node needs to be isolated,
// it will always return false until you call Reset(). Usually Reset()
// will be called in the health check thread.
// will be called in the health check thread.
bool OnCallEnd(int error_code, int64_t latency);
// Reset CircuitBreaker and clear history data. will erase the historical
// data and start sampling again. Before you call this method, you need to
// ensure that no one else is calling OnCallEnd.
// ensure that no one else is accessing CircuitBreaker.
void Reset();
// Mark the Socket as broken. Call this method when you want to isolate a
......
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