Merge pull request #9741 from annando/worker-cooldown

Additional worker cooldown
This commit is contained in:
Hypolite Petovan 2021-01-02 15:04:29 -05:00 committed by GitHub
commit 7e8f13d703
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -411,6 +411,12 @@ class Worker
{
$a = DI::app();
$cooldown = DI::config()->get("system", "worker_cooldown", 0);
if ($cooldown > 0) {
Logger::info('Pre execution cooldown.', ['priority' => $queue["priority"], 'id' => $queue["id"], 'cooldown' => $cooldown]);
sleep($cooldown);
}
Logger::enableWorker($funcname);
Logger::info("Process start.", ['priority' => $queue["priority"], 'id' => $queue["id"]]);
@ -483,10 +489,8 @@ class Worker
DI::profiler()->saveLog(DI::logger(), "ID " . $queue["id"] . ": " . $funcname);
$cooldown = DI::config()->get("system", "worker_cooldown", 0);
if ($cooldown > 0) {
Logger::info('Cooldown.', ['priority' => $queue["priority"], 'id' => $queue["id"], 'cooldown' => $cooldown]);
Logger::info('Post execution cooldown.', ['priority' => $queue["priority"], 'id' => $queue["id"], 'cooldown' => $cooldown]);
sleep($cooldown);
}
}