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 <daniel@ziegenberg.at>
This commit is contained in:
Daniel Ziegenberg 2021-10-12 19:15:43 +02:00
parent 51149a78cc
commit 371b490a1f
No known key found for this signature in database
GPG Key ID: 7E6F98FFADBEFD39

View File

@ -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)) {