Remove tasks if processing requirements are false

[MAILPOET-2530]
This commit is contained in:
Amine Ben hammou
2019-11-25 10:22:27 +01:00
committed by Jack Kitterhing
parent dc5e2ae386
commit 371b6a2824

View File

@ -47,15 +47,18 @@ abstract class SimpleWorker {
// abort if execution limit is reached
$this->cron_helper->enforceExecutionLimit($timer);
$scheduled_tasks = $this->getDueTasks();
$running_tasks = $this->getRunningTasks();
if (!$this->checkProcessingRequirements()) {
foreach (array_merge($scheduled_tasks, $running_tasks) as $task) {
$task->delete();
}
return false;
}
$this->init();
$scheduled_tasks = $this->getDueTasks();
$running_tasks = $this->getRunningTasks();
if (!$scheduled_tasks && !$running_tasks) {
if (static::AUTOMATIC_SCHEDULING) {