mirror of
https://github.com/moodle/moodle.git
synced 2025-04-14 04:52:36 +02:00
MDL-65393 core: Make session history cleanup more aggressive.
This commit is contained in:
parent
6a7451ff1b
commit
dbed8bdb86
@ -1109,12 +1109,18 @@ class manager {
|
||||
global $SESSION;
|
||||
|
||||
$locks = self::get_recent_session_locks();
|
||||
|
||||
$maximumstoredhistory = 50;
|
||||
if (count($locks) > $maximumstoredhistory) {
|
||||
$locks = array_slice($locks, -$maximumstoredhistory);
|
||||
}
|
||||
|
||||
if (count($locks) > 2) {
|
||||
for ($i = count($locks) - 1; $i > 0; $i--) {
|
||||
// Calculate the gap between session locks.
|
||||
$gap = $locks[$i]['released'] - $locks[$i - 1]['start'];
|
||||
if ($gap >= 10) {
|
||||
// Remove previous locks if the gap is 10 seconds or more.
|
||||
if ($gap >= 1) {
|
||||
// Remove previous locks if the gap is 1 second or more.
|
||||
$SESSION->recentsessionlocks = array_slice($locks, $i);
|
||||
break;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user