Unverified Commit f43bdcec authored by Ge Jun's avatar Ge Jun Committed by GitHub

Merge pull request #824 from zyearn/fix_lalb_base_weight_to_zero

fix lalb be disabled wrongly
parents 96665f33 d4cc3f3f
...@@ -555,7 +555,7 @@ LocalityAwareLoadBalancer::Weight::~Weight() { ...@@ -555,7 +555,7 @@ LocalityAwareLoadBalancer::Weight::~Weight() {
int64_t LocalityAwareLoadBalancer::Weight::Disable() { int64_t LocalityAwareLoadBalancer::Weight::Disable() {
BAIDU_SCOPED_LOCK(_mutex); BAIDU_SCOPED_LOCK(_mutex);
const int64_t saved = _weight; const int64_t saved = _weight;
_base_weight = 0; _base_weight = -1;
_weight = 0; _weight = 0;
return saved; return saved;
} }
......
...@@ -86,7 +86,7 @@ private: ...@@ -86,7 +86,7 @@ private:
void Describe(std::ostream& os, int64_t now); void Describe(std::ostream& os, int64_t now);
int64_t Disable(); int64_t Disable();
bool Disabled() const { return _base_weight == 0; } bool Disabled() const { return _base_weight < 0; }
int64_t MarkOld(size_t index); int64_t MarkOld(size_t index);
std::pair<int64_t, int64_t> ClearOld(); std::pair<int64_t, int64_t> ClearOld();
......
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