From 5a0cde49cc80e395a85204f9e9a15dd1884acc1e Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 16 May 2023 23:37:58 +0100 Subject: [PATCH] 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. --- src/scheduler/AsyncPool.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scheduler/AsyncPool.php b/src/scheduler/AsyncPool.php index 9029eb593..99175651d 100644 --- a/src/scheduler/AsyncPool.php +++ b/src/scheduler/AsyncPool.php @@ -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 }