chg: remove sleep from worker poll

pull/7939/head
Luciano Righetti 2021-11-10 08:27:31 +01:00
parent 9f65954499
commit 30bb52d705
1 changed files with 0 additions and 14 deletions

View File

@ -12,13 +12,9 @@ class StartWorkerShell extends AppShell
/** @var Worker */
private $worker;
/** @var int */
private $sleepInterval;
/** @var int */
private $maxExecutionTime;
private const DEFAULT_SLEEP_INTERVAL = 5; // seconds
private const DEFAULT_MAX_EXECUTION_TIME = 86400; // 1 day
public $tasks = ['ConfigLoad'];
@ -42,13 +38,6 @@ class StartWorkerShell extends AppShell
'required' => true
])
->addOption(
'sleep',
[
'help' => 'Sleep interval between jobs (seconds).',
'default' => self::DEFAULT_SLEEP_INTERVAL,
'required' => false
]
)->addOption(
'maxExecutionTime',
[
'help' => 'Worker maximum execution time (seconds) before it self-destruct.',
@ -70,7 +59,6 @@ class StartWorkerShell extends AppShell
]
);
$this->sleepInterval = (int)$this->params['sleep'];
$this->maxExecutionTime = (int)$this->params['maxExecutionTime'];
CakeLog::info("[WORKER PID: {$this->worker->pid()}][{$this->worker->queue()}] - starting to process background jobs...");
@ -93,8 +81,6 @@ class StartWorkerShell extends AppShell
$this->BackgroundJobsTool->update($job);
}
}
sleep($this->sleepInterval);
}
}