Skip to content

Commit

Permalink
fix consistent hash bug
Browse files Browse the repository at this point in the history
  • Loading branch information
suziliu committed Jun 26, 2017
1 parent 25bb40e commit 2593ec1
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions cpp/servant/libservant/EndpointManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1241,11 +1241,8 @@ void EndpointManager::updateConHashProxyWeighted(bool bStatic, vector<AdapterPro
return ;
}

if(bStatic)
{
vLastConHashProxys = _vRegProxys;
conHash.clear();
}
vLastConHashProxys = _vRegProxys;
conHash.clear();

for(size_t i = 0; i < _vRegProxys.size(); ++i)
{
Expand All @@ -1257,7 +1254,7 @@ void EndpointManager::updateConHashProxyWeighted(bool bStatic, vector<AdapterPro
{
iWeight = 1;
}
conHash.addNode(_vRegProxys[i]->endpoint().desc(), i, _vRegProxys[i]->getWeight());
conHash.addNode(_vRegProxys[i]->endpoint().desc(), i, iWeight);
}
}

Expand Down Expand Up @@ -1362,7 +1359,7 @@ AdapterProxy* EndpointManager::getConHashProxyForNormal(int64_t hashCode)
{
int64_t iBegin = TNOWMS;

updateConHashProxyWeighted(true, _lastConHashProxys, _consistentHash);
updateConHashProxyWeighted(false, _lastConHashProxys, _consistentHash);

int64_t iEnd = TNOWMS;

Expand Down

0 comments on commit 2593ec1

Please sign in to comment.