Skip to content

Commit

Permalink
rewrite BRPOPLPUSH as RPOPLPUSH to propagate
Browse files Browse the repository at this point in the history
  • Loading branch information
israellot committed Mar 12, 2019
1 parent 864f8d2 commit 89f828f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -1376,6 +1376,7 @@ void createSharedObjects(void) {
shared.rpop = createStringObject("RPOP", 4);
shared.lpop = createStringObject("LPOP", 4);
shared.lpush = createStringObject("LPUSH", 5);
shared.rpoplpush = createStringObject("RPOPLPUSH",9);
for (j = 0; j < OBJ_SHARED_INTEGERS; j++) {
shared.integers[j] =
makeObjectShared(createObject(OBJ_STRING, (void*) (PORT_LONG) j));
Expand Down
2 changes: 1 addition & 1 deletion src/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ struct sharedObjectsStruct {
*masterdownerr, *roslaveerr, *execaborterr, *noautherr, *noreplicaserr,
*busykeyerr, *oomerr, *plus, *messagebulk, *pmessagebulk, *subscribebulk,
*unsubscribebulk, *psubscribebulk, *punsubscribebulk, *del, *unlink,
*rpop, *lpop, *lpush, *emptyscan,
*rpop, *lpop, *lpush, *rpoplpush, *emptyscan,
*select[PROTO_SHARED_SELECT_CMDS],
*integers[OBJ_SHARED_INTEGERS],
*mbulkhdr[OBJ_SHARED_BULKHDR_LEN], /* "*<value>\r\n" */
Expand Down
3 changes: 3 additions & 0 deletions src/t_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,9 @@ void rpoplpushCommand(client *c) {
signalModifiedKey(c->db,touchedkey);
decrRefCount(touchedkey);
server.dirty++;
if (c->cmd->proc == brpoplpushCommand) {
rewriteClientCommandVector(c,3,shared.rpoplpush,c->argv[1],c->argv[2]);
}
}
}

Expand Down

0 comments on commit 89f828f

Please sign in to comment.