e63ed5511b
If for any reason a Redis session lock is not being released, all subsequent requests will wait to acquire the lock, forcing them to time out eventually. This will happen till the original lock finally expires after the session timeout. This sets the Redis session lock expiry time to whatever is lower, either the PHP execution time `max_execution_time`, if the value was defined in the `php.ini` or the globally configured `sessiontimeout`. Setting it to the lower of the two will not make things worse it if the execution timeout is longer than the session timeout. For the PHP execution time, once the PHP execution time is over, we can be sure that the lock is no longer actively held so that the lock can expire safely. Although at `lib/classes/php_time_limit.php::raise(int)`, Moodle can progressively increase the maximum PHP execution time, this is limited to the `max_execution_time` value defined in the `php.ini`. For the session timeout, we assume it is safe to consider the lock to expire once the session itself expires. If we unnecessarily hold the lock any longer, it blocks other session requests. Co-authored-by: Daniel Ziegenberg <daniel@ziegenberg.at> Signed-off-by: Daniel Ziegenberg <daniel@ziegenberg.at>