Reschedule failing cron tasks progressively [MAILPOET-2181]

This commit is contained in:
wxa
2019-07-28 16:42:47 +03:00
committed by M. Shull
parent e1b8462254
commit 8b867a7b4f
9 changed files with 86 additions and 27 deletions

View File

@@ -50,11 +50,19 @@ abstract class SimpleWorker {
return false;
}
foreach ($scheduled_tasks as $i => $task) {
$this->prepareTask($task);
}
foreach ($running_tasks as $i => $task) {
$this->processTask($task);
$task = null;
try {
foreach ($scheduled_tasks as $i => $task) {
$this->prepareTask($task);
}
foreach ($running_tasks as $i => $task) {
$this->processTask($task);
}
} catch (\Exception $e) {
if ($task) {
$task->rescheduleProgressively();
}
throw $e;
}
return true;