public function onRun($t) { $this->nextScheduled = false; while (isset($this->queue[0])) { if ($this->queue[0]->canRun()) { /** @var Runnable $runnable */ $runnable = array_shift($this->queue); try { $runnable->run(); } catch (\Exception $e) { $this->getMain()->getServer()->getScheduler()->scheduleAsyncTask(new ReportErrorTask($e, "queue {$this->queueId} execution of runnable " . get_class($runnable))); $this->scheduleNext(); return; } } else { $this->scheduleNext(); return; } } if ($this->garbageable and !isset($this->queue[0])) { $this->main->garbageQueue($this->getQueueId(), $this->flag); } }