AsyncPool: do not double-check progress updates on finished tasks

checkProgressUpdates is called directly before onCompletion, so we only need to call it again if the task isn't finished yet.
This commit is contained in:
Dylan K. Taylor
2023-05-16 23:37:58 +01:00
parent 008a022ec1
commit 5a0cde49cc

View File

@ -247,7 +247,6 @@ class AsyncPool{
while(!$queue->isEmpty()){
/** @var AsyncTask $task */
$task = $queue->bottom();
$task->checkProgressUpdates();
if($task->isFinished()){ //make sure the task actually executed before trying to collect
$queue->dequeue();
@ -268,6 +267,7 @@ class AsyncPool{
$task->onCompletion();
}
}else{
$task->checkProgressUpdates();
$more = true;
break; //current task is still running, skip to next worker
}