mirror of
https://github.com/Mibew/mibew.git
synced 2025-02-12 18:41:08 +03:00
Fix race condition in old invitation closing
This commit is contained in:
parent
b3c9a02660
commit
6e200bf956
@ -21,6 +21,7 @@
|
|||||||
use Mibew\EventDispatcher\EventDispatcher;
|
use Mibew\EventDispatcher\EventDispatcher;
|
||||||
use Mibew\EventDispatcher\Events;
|
use Mibew\EventDispatcher\Events;
|
||||||
use Mibew\Database;
|
use Mibew\Database;
|
||||||
|
use Mibew\ProcessLock;
|
||||||
use Mibew\Settings;
|
use Mibew\Settings;
|
||||||
use Mibew\Thread;
|
use Mibew\Thread;
|
||||||
|
|
||||||
@ -248,6 +249,9 @@ function invitation_reject($visitor_id)
|
|||||||
*/
|
*/
|
||||||
function invitation_close_old()
|
function invitation_close_old()
|
||||||
{
|
{
|
||||||
|
// Run only one instance of cleaning process.
|
||||||
|
$lock = new ProcessLock('invitations_close_old');
|
||||||
|
if ($lock->get()) {
|
||||||
$db = Database::getInstance();
|
$db = Database::getInstance();
|
||||||
|
|
||||||
// Get all threads to close
|
// Get all threads to close
|
||||||
@ -299,6 +303,10 @@ function invitation_close_old()
|
|||||||
|
|
||||||
unset($thread);
|
unset($thread);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Release the lock
|
||||||
|
$lock->release();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user