mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-05 19:37:17 +00:00
TaskScheduler: fixed tasks not getting destroyed when all tasks in scheduler are cancelled before next heartbeat
they got removed from the tasks array, but not from the queue (for performance reasons). The queue gets cleaned up by the heartbeat, but it was checking if there were things in the main array, not in the queue. There are a couple of other bugs with cancelling tasks that this doesn't fix that are rather more complicated to deal with.
This commit is contained in:
parent
7b7be9618c
commit
95787c2be9
@ -222,7 +222,7 @@ class TaskScheduler{
|
||||
}
|
||||
|
||||
private function isReady(int $currentTick) : bool{
|
||||
return count($this->tasks) > 0 and $this->queue->current()->getNextRun() <= $currentTick;
|
||||
return !$this->queue->isEmpty() and $this->queue->current()->getNextRun() <= $currentTick;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user