Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for LPOP and BRPOP #774

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/dyn_message.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@
ACTION(REQ_REDIS_KEYS) \
ACTION(REQ_REDIS_INFO) \
ACTION(REQ_REDIS_LINDEX) /* redis requests - lists */ \
ACTION(REQ_REDIS_BLPOP) \
ACTION(REQ_REDIS_BRPOP) \
ACTION(REQ_REDIS_LINSERT) \
ACTION(REQ_REDIS_LLEN) \
ACTION(REQ_REDIS_LPOP) \
Expand Down
16 changes: 16 additions & 0 deletions src/proto/dyn_redis.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ static bool redis_arg1(struct msg *r) {
case MSG_REQ_REDIS_CONFIG:
case MSG_REQ_REDIS_SCRIPT_LOAD:
case MSG_REQ_REDIS_SCRIPT_EXISTS:
case MSG_REQ_REDIS_BLPOP:
case MSG_REQ_REDIS_BRPOP:

return true;

Expand Down Expand Up @@ -797,6 +799,7 @@ void redis_parse_req(struct msg *r, struct context *ctx) {
break;
}


if (str4icmp(m, 'l', 'r', 'e', 'm')) {
r->type = MSG_REQ_REDIS_LREM;
r->is_read = 0;
Expand Down Expand Up @@ -918,6 +921,19 @@ void redis_parse_req(struct msg *r, struct context *ctx) {
break;

case 5:

if (str5icmp(m, 'b', 'l', 'p', 'o', 'p')) {
r->type = MSG_REQ_REDIS_BLPOP;
r->is_read = 0;
break;
}

if (str5icmp(m, 'b', 'r', 'p', 'o', 'p')) {
r->type = MSG_REQ_REDIS_BRPOP;
r->is_read = 0;
break;
}

if (str5icmp(m, 'h', 'k', 'e', 'y', 's')) {
r->type = MSG_REQ_REDIS_HKEYS;
r->msg_routing = ROUTING_TOKEN_OWNER_LOCAL_RACK_ONLY;
Expand Down