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

RESP3 PUSH support for MONITOR command #1426

Open
wants to merge 10 commits into
base: unstable
Choose a base branch
from
2 changes: 2 additions & 0 deletions src/replication.c
Original file line number Diff line number Diff line change
Expand Up @@ -705,10 +705,12 @@ void replicationFeedMonitors(client *c, list *monitors, int dictid, robj **argv,
while ((ln = listNext(&li))) {
client *monitor = ln->value;
if (monitor->resp > 2) {
struct ClientFlags old_flags = monitor->flag;
monitor->flag.pushing = 1;
zuiderkwast marked this conversation as resolved.
Show resolved Hide resolved
addReplyPushLen(monitor, 2);
addReply(monitor, shared.monitorbulk);
addReply(monitor, cmdobj);
if (!old_flags.pushing) monitor->flag.pushing = 0;
} else {
addReply(monitor, cmdobj);
}
Expand Down
20 changes: 20 additions & 0 deletions tests/unit/introspection.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,26 @@ start_server {tags {"introspection"}} {
$rd close
}

test {MONITOR should came after PONG reply} {
set rd [valkey_deferring_client]
$rd HELLO 3
$rd read ; # Consume the HELLO reply

$rd monitor
$rd read ; # Consume the MONITOR reply
$rd readraw 1;

r ping
zuiderkwast marked this conversation as resolved.
Show resolved Hide resolved

assert_equal "+pong" [$rd read]
assert_equal ">2" [$rd read]
assert_equal "\$7" [$rd read]
assert_equal "monitor" [$rd read]
assert_match {*"ping"*} [$rd read]

$rd close
}

test {MONITOR can log commands issued by the scripting engine} {
set rd [valkey_deferring_client]
$rd monitor
Expand Down