Fix: client pause uses an old timeout (#9477)

A write request may be paused unexpectedly because `server.client_pause_end_time` is old.

**Recreate this:**
redis-cli -p 6379
127.0.0.1:6379> client pause 500000000 write
OK
127.0.0.1:6379> client unpause
OK
127.0.0.1:6379> client pause 10000 write
OK
127.0.0.1:6379> set key value

The write request `set key value` is paused util  the timeout of 500000000 milliseconds was reached.

**Fix:**
reset `server.client_pause_end_time` = 0 in `unpauseClients`

(cherry picked from commit f560531d5b8a6e6d810b62114e69a5ffda7730f7)
This commit is contained in:
yvette903 2021-09-09 18:44:48 +08:00 committed by Oran Agra
parent 9b25484a13
commit 23ed37dd87
2 changed files with 5 additions and 0 deletions

View File

@ -3364,6 +3364,7 @@ void unpauseClients(void) {
client *c;
server.client_pause_type = CLIENT_PAUSE_OFF;
server.client_pause_end_time = 0;
/* Unblock all of the clients so they are reprocessed. */
listRewind(server.paused_clients,&li);

View File

@ -2764,6 +2764,10 @@ void initServerConfig(void) {
* Redis 5. However it is possible to revert it via redis.conf. */
server.lua_always_replicate_commands = 1;
/* Client Pause related */
server.client_pause_type = CLIENT_PAUSE_OFF;
server.client_pause_end_time = 0;
initConfigValues();
}