major update
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace MintyPHP\Service\User;
|
||||
|
||||
use MintyPHP\DB;
|
||||
use MintyPHP\Repository\Support\DatabaseSessionRepository;
|
||||
use MintyPHP\Repository\Support\RepoQuery;
|
||||
use MintyPHP\Repository\User\UserReadRepository;
|
||||
use MintyPHP\Repository\User\UserWriteRepository;
|
||||
@@ -18,7 +18,8 @@ class UserLifecycleService
|
||||
private readonly UserReadRepository $userReadRepository,
|
||||
private readonly UserWriteRepository $userWriteRepository,
|
||||
private readonly UserSettingsGateway $settingsGateway,
|
||||
private readonly UserLifecycleAuditService $userLifecycleAuditService
|
||||
private readonly UserLifecycleAuditService $userLifecycleAuditService,
|
||||
private readonly DatabaseSessionRepository $databaseSessionRepository
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -167,14 +168,13 @@ class UserLifecycleService
|
||||
|
||||
private function acquireLock(): bool
|
||||
{
|
||||
$gotLock = DB::selectValue('select GET_LOCK(?, 0) as got_lock', self::LOCK_NAME);
|
||||
return (int) $gotLock === 1;
|
||||
return $this->databaseSessionRepository->acquireAdvisoryLock(self::LOCK_NAME, 0);
|
||||
}
|
||||
|
||||
private function releaseLock(): void
|
||||
{
|
||||
try {
|
||||
DB::selectValue('select RELEASE_LOCK(?) as released_lock', self::LOCK_NAME);
|
||||
$this->databaseSessionRepository->releaseAdvisoryLock(self::LOCK_NAME);
|
||||
} catch (\Throwable $exception) {
|
||||
// no-op
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user