mirror of
https://github.com/fluencelabs/redis
synced 2025-03-30 22:31:03 +00:00
Cluster: use node->numslots instead of popcount() where possible.
This commit is contained in:
parent
4521115b17
commit
d21d6b666f
@ -1110,8 +1110,7 @@ void clusterSendPing(clusterLink *link, int type) {
|
|||||||
*/
|
*/
|
||||||
if (this == server.cluster->myself ||
|
if (this == server.cluster->myself ||
|
||||||
this->flags & (REDIS_NODE_HANDSHAKE|REDIS_NODE_NOADDR) ||
|
this->flags & (REDIS_NODE_HANDSHAKE|REDIS_NODE_NOADDR) ||
|
||||||
(this->link == NULL &&
|
(this->link == NULL && this->numslots == 0))
|
||||||
popcount(this->slots,sizeof(this->slots)) == 0))
|
|
||||||
{
|
{
|
||||||
freshnodes--; /* otherwise we may loop forever. */
|
freshnodes--; /* otherwise we may loop forever. */
|
||||||
continue;
|
continue;
|
||||||
@ -1418,8 +1417,7 @@ void clusterUpdateState(void) {
|
|||||||
while((de = dictNext(di)) != NULL) {
|
while((de = dictNext(di)) != NULL) {
|
||||||
clusterNode *node = dictGetVal(de);
|
clusterNode *node = dictGetVal(de);
|
||||||
|
|
||||||
if (node->flags & REDIS_NODE_MASTER &&
|
if (node->flags & REDIS_NODE_MASTER && node->numslots)
|
||||||
popcount(node->slots,sizeof(node->slots)))
|
|
||||||
server.cluster->size++;
|
server.cluster->size++;
|
||||||
}
|
}
|
||||||
dictReleaseIterator(di);
|
dictReleaseIterator(di);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user