job no table locking param

This commit is contained in:
Yuri Kuznetsov
2023-04-21 11:13:05 +03:00
parent fffa608816
commit fe32d8d47b
3 changed files with 14 additions and 3 deletions

View File

@@ -49,4 +49,9 @@ class ConfigDataProvider
{
return (int) $this->config->get('cronMinInterval', 0);
}
public function noTableLocking(): bool
{
return (bool) $this->config->get('jobNoTableLocking');
}
}

View File

@@ -39,12 +39,17 @@ use Spatie\Async\Pool as AsyncPool;
class QueueProcessor
{
private bool $noTableLocking;
public function __construct(
private QueueUtil $queueUtil,
private JobRunner $jobRunner,
private AsyncPoolFactory $asyncPoolFactory,
private EntityManager $entityManager
) {}
private EntityManager $entityManager,
ConfigDataProvider $configDataProvider
) {
$this->noTableLocking = $configDataProvider->noTableLocking();
}
public function process(Params $params): void
{
@@ -68,7 +73,7 @@ class QueueProcessor
private function processJob(Params $params, JobEntity $job, ?AsyncPool $pool = null): void
{
$noLock = $params->noLock();
$lockTable = $job->getScheduledJobId() && !$noLock;
$lockTable = $job->getScheduledJobId() && !$noLock && !$this->noTableLocking;
if ($lockTable) {
// MySQL doesn't allow to lock non-existent rows. We resort to locking an entire table.

View File

@@ -101,6 +101,7 @@ return [
'authLogDisabled',
'authApiUserLogDisabled',
'ipAddressServerParam',
'jobNoTableLocking',
],
'adminItems' => [
'devMode',