Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
d49d0238
Unverified
Commit
d49d0238
authored
May 31, 2018
by
Salvatore Sanfilippo
Committed by
GitHub
May 31, 2018
Browse files
Merge pull request #4971 from soloestoy/bugfix-bzpop
ZPOP: unblock multiple clients in right way
parents
2dee9a41
b9d19371
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/blocked.c
View file @
d49d0238
...
...
@@ -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
];
...
...
src/t_zset.c
View file @
d49d0238
...
...
@@ -3216,9 +3216,9 @@ void blockingGenericZpopCommand(client *c, int where) {
return
;
}
else
{
if
(
zsetLength
(
o
)
!=
0
)
{
/* Non empty zset, this is like a normal Z
[REV]POP
. */
/* Non empty zset, this is like a normal Z
POP[MIN|MAX]
. */
genericZpopCommand
(
c
,
&
c
->
argv
[
j
],
1
,
where
,
1
,
NULL
);
/* Replicate it as an Z
[REV]POP
instead of BZ
[REV]POP
. */
/* Replicate it as an Z
POP[MIN|MAX]
instead of BZ
POP[MIN|MAX]
. */
rewriteClientCommandVector
(
c
,
2
,
where
==
ZSET_MAX
?
shared
.
zpopmax
:
shared
.
zpopmin
,
c
->
argv
[
j
]);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment