Skip to content

Commit

Permalink
Merge pull request #824 from zyearn/fix_lalb_base_weight_to_zero
Browse files Browse the repository at this point in the history
fix lalb be disabled wrongly
  • Loading branch information
jamesge authored Jul 13, 2019
2 parents 96665f3 + d4cc3f3 commit f43bdce
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/brpc/policy/locality_aware_load_balancer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/brpc/policy/locality_aware_load_balancer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<int64_t, int64_t> ClearOld();

Expand Down

0 comments on commit f43bdce

Please sign in to comment.