chg: [internal] Use one EventLock instance

pull/7640/head
Jakub Onderka 2021-07-20 11:40:28 +02:00
parent 673f48c10d
commit c53c860b58
1 changed files with 5 additions and 3 deletions

View File

@ -3813,8 +3813,10 @@ class Event extends AppModel
if ($saveResult) {
if ($jobId) {
/** @var EventLock $eventLock */
$eventLock = ClassRegistry::init('EventLock');
$eventLock->insertLockBackgroundJob($this->id, $jobId);
if (!isset($this->EventLock)) {
$this->EventLock = ClassRegistry::init('EventLock');
}
$this->EventLock->insertLockBackgroundJob($this->id, $jobId);
}
if ($passAlong) {
@ -3943,7 +3945,7 @@ class Event extends AppModel
}
}
if ($jobId) {
$eventLock->deleteBackgroundJobLock($this->id, $jobId);
$this->EventLock->deleteBackgroundJobLock($this->id, $jobId);
}
return true;