diff options
author | zhaozhao.zz <zhaozhao.zz@alibaba-inc.com> | 2018-05-31 23:35:47 +0800 |
---|---|---|
committer | zhaozhao.zz <zhaozhao.zz@alibaba-inc.com> | 2018-05-31 23:35:47 +0800 |
commit | b9d19371e402fc8e6d1ca70863ab0e06889ff1c3 (patch) | |
tree | 9c76c54413969a936c4835572f880cb2496be780 /src/blocked.c | |
parent | 3d5e2c62e2690cf4a4954ab846bc119c56cad66d (diff) | |
download | redis-b9d19371e402fc8e6d1ca70863ab0e06889ff1c3.tar.gz |
ZPOP: unblock multiple clients in right way
Diffstat (limited to 'src/blocked.c')
-rw-r--r-- | src/blocked.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/blocked.c b/src/blocked.c index 023fba0cd..8d1157c2c 100644 --- a/src/blocked.c +++ b/src/blocked.c @@ -314,8 +314,9 @@ void handleClientsBlockedOnKeys(void) { if (de) { list *clients = dictGetVal(de); int numclients = listLength(clients); + unsigned long zcard = zsetLength(o); - while(numclients--) { + while(numclients-- && zcard) { listNode *clientnode = listFirst(clients); client *receiver = clientnode->value; @@ -332,6 +333,7 @@ void handleClientsBlockedOnKeys(void) { ? ZSET_MIN : ZSET_MAX; unblockClient(receiver); genericZpopCommand(receiver,&rl->key,1,where,1,NULL); + zcard--; /* Replicate the command. */ robj *argv[2]; |