AsyncPool: Unstack tasks from workers before entering the below loop

This commit is contained in:
Dylan K. Taylor 2018-05-30 11:17:16 +01:00
parent b7ca045c51
commit 7fce48d38c

View File

@ -123,6 +123,15 @@ class AsyncPool{
}
public function removeTasks(){
foreach($this->workers as $worker){
/** @var AsyncTask $task */
while(($task = $worker->unstack()) !== null){
//cancelRun() is not strictly necessary here, but it might be used to inform plugins of the task state
//(i.e. it never executed).
$task->cancelRun();
$this->removeTask($task, true);
}
}
do{
foreach($this->tasks as $task){
$task->cancelRun();