ZPOP: change sync ZPOP to have a count argument instead of N keys.

Usually blocking operations make a lot of sense with multiple keys so
that we can listen to multiple queues (or whatever the app models) with
a single connection. However in the synchronous case it is more useful
to be able to ask for N elements. This is a change that I also wanted to
perform soon or later in the blocking list variant, but here it is more
natural since there is no reply type difference.
This commit is contained in:
antirez
2018-05-11 18:00:32 +02:00
parent 6efb6c1e06
commit 56bbab238a
3 changed files with 95 additions and 56 deletions

View File

@ -331,7 +331,7 @@ void handleClientsBlockedOnKeys(void) {
receiver->lastcmd->proc == bzpopminCommand)
? ZSET_MIN : ZSET_MAX;
unblockClient(receiver);
genericZpopCommand(receiver,&rl->key,1,where);
genericZpopCommand(receiver,&rl->key,1,where,1,NULL);
propagate(where == ZSET_MIN ?
server.zpopminCommand : server.zpopmaxCommand,