/** * @param WorkerInterface $worker * @param int $delay Seconds to wait before pulling the queue again */ public function process($worker, $delay = 0) { while (true) { if (!$this->isEmpty()) { $worker->add($this->pull()); } sleep($delay); } }