diff --git a/src/brpc/policy/locality_aware_load_balancer.cpp b/src/brpc/policy/locality_aware_load_balancer.cpp index 7a3cb3e628..e5d91fd6db 100644 --- a/src/brpc/policy/locality_aware_load_balancer.cpp +++ b/src/brpc/policy/locality_aware_load_balancer.cpp @@ -555,7 +555,7 @@ LocalityAwareLoadBalancer::Weight::~Weight() { int64_t LocalityAwareLoadBalancer::Weight::Disable() { BAIDU_SCOPED_LOCK(_mutex); const int64_t saved = _weight; - _base_weight = 0; + _base_weight = -1; _weight = 0; return saved; } diff --git a/src/brpc/policy/locality_aware_load_balancer.h b/src/brpc/policy/locality_aware_load_balancer.h index 3c269d8f20..8da16c0378 100644 --- a/src/brpc/policy/locality_aware_load_balancer.h +++ b/src/brpc/policy/locality_aware_load_balancer.h @@ -86,7 +86,7 @@ class LocalityAwareLoadBalancer : public LoadBalancer { void Describe(std::ostream& os, int64_t now); int64_t Disable(); - bool Disabled() const { return _base_weight == 0; } + bool Disabled() const { return _base_weight < 0; } int64_t MarkOld(size_t index); std::pair ClearOld();