mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
MDL-80281 session: Don't report long session locks for readonly sessions
Previously, $CFG->sessionlockdebug was reporting long session locks for all requests, even if they defined READ_ONLY_SESSION. This change ensures that only sessions with locks are reported.
This commit is contained in:
parent
6374475dc3
commit
0757441874
@ -162,9 +162,11 @@ class manager {
|
||||
throw new \core\session\exception(get_string('servererror'));
|
||||
}
|
||||
|
||||
// Grab the time when session lock starts.
|
||||
$PERF->sessionlock['gained'] = microtime(true);
|
||||
$PERF->sessionlock['wait'] = $PERF->sessionlock['gained'] - $PERF->sessionlock['start'];
|
||||
if ($requireslock) {
|
||||
// Grab the time when session lock starts.
|
||||
$PERF->sessionlock['gained'] = microtime(true);
|
||||
$PERF->sessionlock['wait'] = $PERF->sessionlock['gained'] - $PERF->sessionlock['start'];
|
||||
}
|
||||
self::initialise_user_session($isnewsession);
|
||||
self::$sessionactive = true; // Set here, so the session can be cleared if the security check fails.
|
||||
self::check_security();
|
||||
@ -689,14 +691,17 @@ class manager {
|
||||
global $PERF, $ME, $CFG;
|
||||
|
||||
if (self::$sessionactive) {
|
||||
// Grab the time when session lock is released.
|
||||
$PERF->sessionlock['released'] = microtime(true);
|
||||
if (!empty($PERF->sessionlock['gained'])) {
|
||||
$PERF->sessionlock['held'] = $PERF->sessionlock['released'] - $PERF->sessionlock['gained'];
|
||||
$requireslock = self::$handler->requires_write_lock();
|
||||
if ($requireslock) {
|
||||
// Grab the time when session lock is released.
|
||||
$PERF->sessionlock['released'] = microtime(true);
|
||||
if (!empty($PERF->sessionlock['gained'])) {
|
||||
$PERF->sessionlock['held'] = $PERF->sessionlock['released'] - $PERF->sessionlock['gained'];
|
||||
}
|
||||
$PERF->sessionlock['url'] = me();
|
||||
self::update_recent_session_locks($PERF->sessionlock);
|
||||
self::sessionlock_debugging();
|
||||
}
|
||||
$PERF->sessionlock['url'] = me();
|
||||
self::update_recent_session_locks($PERF->sessionlock);
|
||||
self::sessionlock_debugging();
|
||||
|
||||
// If debugging, take a snapshot of session at close and compare on shutdown to detect any accidental mutations.
|
||||
if (debugging()) {
|
||||
@ -704,7 +709,6 @@ class manager {
|
||||
\core_shutdown_manager::register_function('\core\session\manager::check_mutated_closed_session');
|
||||
}
|
||||
|
||||
$requireslock = self::$handler->requires_write_lock();
|
||||
if (!$requireslock || !self::$requireslockdebug) {
|
||||
// Compare the array of the earlier session data with the array now, if
|
||||
// there is a difference then a lock is required.
|
||||
|
Loading…
x
Reference in New Issue
Block a user