From 568e2760f1c0beba5b347c416fad231ea3025919 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 17 May 2017 19:30:50 +0100 Subject: [PATCH] Collect workers when cancelling all tasks --- src/pocketmine/scheduler/AsyncPool.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/pocketmine/scheduler/AsyncPool.php b/src/pocketmine/scheduler/AsyncPool.php index f9480bf2d..638169e00 100644 --- a/src/pocketmine/scheduler/AsyncPool.php +++ b/src/pocketmine/scheduler/AsyncPool.php @@ -136,6 +136,14 @@ class AsyncPool{ $this->taskWorkers = []; $this->tasks = []; + + $this->collectWorkers(); + } + + private function collectWorkers(){ + foreach($this->workers as $worker){ + $worker->collect(); + } } public function collectTasks(){ @@ -158,9 +166,7 @@ class AsyncPool{ } } - foreach($this->workers as $worker){ - $worker->collect(); - } + $this->collectWorkers(); Timings::$schedulerAsyncTimer->stopTiming(); }