diff --git a/src/server.c b/src/server.c index 2f9fa4f39..0551eb3e4 100644 --- a/src/server.c +++ b/src/server.c @@ -4043,8 +4043,8 @@ int processCommand(client *c) { /* If the server is paused, block the client until * the pause has ended. Replicas are never paused. */ if (!(c->flags & CLIENT_SLAVE) && - ((server.client_pause_type & CLIENT_PAUSE_ALL) || - (server.client_pause_type & CLIENT_PAUSE_WRITE && is_may_replicate_command))) + ((server.client_pause_type == CLIENT_PAUSE_ALL) || + (server.client_pause_type == CLIENT_PAUSE_WRITE && is_may_replicate_command))) { c->bpop.timeout = 0; blockClient(c,BLOCKED_PAUSE); diff --git a/tests/unit/wait.tcl b/tests/unit/wait.tcl index b20900c23..0a4965c20 100644 --- a/tests/unit/wait.tcl +++ b/tests/unit/wait.tcl @@ -5,6 +5,7 @@ start_server {} { set slave [srv 0 client] set slave_host [srv 0 host] set slave_port [srv 0 port] + set slave_pid [srv 0 pid] set master [srv -1 client] set master_host [srv -1 host] set master_port [srv -1 port] @@ -33,23 +34,25 @@ start_server {} { } test {WAIT should not acknowledge 1 additional copy if slave is blocked} { - set cmd [rediscli $slave_host $slave_port "debug sleep 5"] - exec {*}$cmd > /dev/null 2> /dev/null & - after 1000 ;# Give redis-cli the time to execute the command. + exec kill -SIGSTOP $slave_pid $master set foo 0 $master incr foo $master incr foo $master incr foo - assert {[$master wait 1 3000] == 0} + assert {[$master wait 1 1000] == 0} + exec kill -SIGCONT $slave_pid + assert {[$master wait 1 1000] == 1} } test {WAIT implicitly blocks on client pause since ACKs aren't sent} { + exec kill -SIGSTOP $slave_pid $master multi $master incr foo $master client pause 10000 write $master exec assert {[$master wait 1 1000] == 0} $master client unpause + exec kill -SIGCONT $slave_pid assert {[$master wait 1 1000] == 1} } }}