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
e20fb74f
Commit
e20fb74f
authored
Jan 02, 2010
by
antirez
Browse files
Now the PUSH side of RPOPLPUSH is able to unblock clients blocked on BLPOP
parent
08ff05b0
Changes
1
Hide whitespace changes
Inline
Side-by-side
redis.c
View file @
e20fb74f
...
@@ -3862,20 +3862,24 @@ static void rpoplpushcommand(redisClient *c) {
...
@@ -3862,20 +3862,24 @@ static void rpoplpushcommand(redisClient *c) {
robj
*
ele
=
listNodeValue
(
ln
);
robj
*
ele
=
listNodeValue
(
ln
);
list
*
dstlist
;
list
*
dstlist
;
if
(
dobj
==
NULL
)
{
if
(
dobj
&&
dobj
->
type
!=
REDIS_LIST
)
{
/* Create the list if the key does not exist */
dobj
=
createListObject
();
dictAdd
(
c
->
db
->
dict
,
c
->
argv
[
2
],
dobj
);
incrRefCount
(
c
->
argv
[
2
]);
}
else
if
(
dobj
->
type
!=
REDIS_LIST
)
{
addReply
(
c
,
shared
.
wrongtypeerr
);
addReply
(
c
,
shared
.
wrongtypeerr
);
return
;
return
;
}
}
/* Add the element to the target list */
dstlist
=
dobj
->
ptr
;
/* Add the element to the target list (unless it's directly
listAddNodeHead
(
dstlist
,
ele
);
* passed to some BLPOP-ing client */
incrRefCount
(
ele
);
if
(
!
handleClientsWaitingListPush
(
c
,
c
->
argv
[
2
],
ele
))
{
if
(
dobj
==
NULL
)
{
/* Create the list if the key does not exist */
dobj
=
createListObject
();
dictAdd
(
c
->
db
->
dict
,
c
->
argv
[
2
],
dobj
);
incrRefCount
(
c
->
argv
[
2
]);
}
dstlist
=
dobj
->
ptr
;
listAddNodeHead
(
dstlist
,
ele
);
incrRefCount
(
ele
);
}
/* Send the element to the client as reply as well */
/* Send the element to the client as reply as well */
addReplyBulkLen
(
c
,
ele
);
addReplyBulkLen
(
c
,
ele
);
...
...
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