mirror of
https://github.com/Mibew/mibew.git
synced 2025-04-10 09:50:12 +03:00
Remove old visitors in single process
This commit is contained in:
parent
f10079497c
commit
f0c4299ba3
@ -21,6 +21,7 @@
|
||||
use Mibew\EventDispatcher\EventDispatcher;
|
||||
use Mibew\EventDispatcher\Events;
|
||||
use Mibew\Database;
|
||||
use Mibew\ProcessLock;
|
||||
use Mibew\Settings;
|
||||
use Mibew\Thread;
|
||||
|
||||
@ -196,6 +197,8 @@ function track_retrieve_details($visitor)
|
||||
*/
|
||||
function track_remove_old_visitors()
|
||||
{
|
||||
$lock = new ProcessLock('visitors_remove_old');
|
||||
if ($lock->get()) {
|
||||
$db = Database::getInstance();
|
||||
|
||||
// Remove associations of visitors with closed threads
|
||||
@ -218,6 +221,10 @@ function track_remove_old_visitors()
|
||||
':now' => time(),
|
||||
)
|
||||
);
|
||||
|
||||
// Release the lock
|
||||
$lock->release();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user