private function cancelPending() { if (!$this->busyQueue->isEmpty()) { $exception = new WorkerException('Worker was shut down.'); do { $this->busyQueue->dequeue()->cancel($exception); } while (!$this->busyQueue->isEmpty()); } }