Maybe it works now?
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Abel Hoogeveen 2020-07-21 17:52:38 +02:00
parent 80df1dd33e
commit 5d306dac51
Signed by: abelhooge
GPG Key ID: 387E8DC1F73306FC

View File

@ -244,24 +244,23 @@ class ParallelSuperVisor implements SuperVisor
$this->taskStorage->modifyTask($task);
fwrite(STDOUT, "Changed status of task '".$task->getId()."' to status " . Task::getStatusType($task->getStatus()) . PHP_EOL);
}
}
// Check if all tasks are completed
$allCompleted = true;
$anyDelayed = false;
$anyOther = false;
foreach ($this->tasks as $task)
{
if ($task->getStatus() !== Task::COMPLETED && $task->getStatus() !== Task::CANCELLED)
$allCompleted = false;
if ($task->getStatus() === Task::DELAYED)
$anyDelayed = true;
elseif ($task->getStatus() !== Task::COMPLETED && $task->getStatus() !== Task::CANCELLED)
$anyOther = true;
}
// If all are finished and none are delayed
if ($allCompleted && !$anyDelayed)
if (!$anyOther && !$anyDelayed)
return SuperVisor::FINISHED;
elseif ($allCompleted && $anyDelayed)
elseif (!$anyOther && $anyDelayed)
return SuperVisor::CONSTRAINED;
else
return SuperVisor::RUNNING;