From 0ad2a91cdd5ca67a6260fc19b01ce30b11004be4 Mon Sep 17 00:00:00 2001 From: Daniel Ziegenberg Date: Tue, 12 Oct 2021 19:15:43 +0200 Subject: [PATCH] MDL-72796 caching: fix retry delay for redis session cache The random retry delay for redis session cache was calculated as rand(100000, 500000) giving an effective retry delay of 100 seconds to 500 seconds. That's off by a factor of a thousand! Using Redis as a session cache and when the connection hangs, you can get random "cannot obtain session lock" errors because it's waiting up to 500 seconds (or about 8.33 minutes) for a Redis connection. This sets the delay to the originally intended 100ms to 500ms. (see MDL-59866). Signed-off-by: Daniel Ziegenberg --- lib/classes/session/redis.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/classes/session/redis.php b/lib/classes/session/redis.php index 1855238ecc8..93628b51882 100644 --- a/lib/classes/session/redis.php +++ b/lib/classes/session/redis.php @@ -193,7 +193,7 @@ class redis extends handler { try { - $delay = rand(100000, 500000); + $delay = rand(100, 500); // One second timeout was chosen as it is long for connection, but short enough for a user to be patient. if (!$this->connection->connect($this->host, $this->port, 1, null, $delay)) {