Skip to content

Commit

Permalink
Merge pull request TarsCloud#1 from BeyondWUXF/feature/BeyondWUXF/con…
Browse files Browse the repository at this point in the history
…Hash_optimize

一致性hash优化
  • Loading branch information
BeyondWUXF authored Jan 12, 2021
2 parents 43155e5 + 7f27992 commit 2d156df
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion servant/libservant/EndpointManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1320,7 +1320,10 @@ void EndpointManager::updateConHashProxyWeighted(bool bStatic, vector<AdapterPro
{
iWeight = 1;
}
conHash.addNode(_vRegProxys[i]->endpoint().desc(), i, iWeight);
// 同一服务有多个obj的情况
// 同一hash值调用不同的obj会hash到不同的服务器
// 因为addNode会根据desc(ip+port)计算md5,导致顺序不一致
conHash.addNode(_vRegProxys[i]->endpoint().host(), i, iWeight);
}
}

Expand Down

0 comments on commit 2d156df

Please sign in to comment.