src/Worker.php
public function daemon($sleep = 60, $memoryLimit = 128)
    {
        $memoryLimit = $memoryLimit * 1024 * 1024;
        $startTime = time();
        while (true) {
            $ret = $this->runNextJob();

            if (! $ret) { //没有获取到job
                sleep($sleep);
            }

            ($this->memoryExceeded($memoryLimit) || $this->queueShouldRestart($startTime)) &&
                $this->stop();
        }
    }
public function daemon($sleep = 60, $memoryLimit = 128)
    {
        $memoryLimit = $memoryLimit * 1024 * 1024;
        $startTime = time();
        while (true) {
            $ret = $this->runNextJob();

            if (! $ret) { //没有获取到job
                sleep($sleep);
            }

            ($this->memoryExceeded($memoryLimit) || $this->queueShouldRestart($startTime)) &&
                $this->stop();
        }
    }
Listen to the given queue in a loop.

@param int $sleep 没有新的有效任务产生时的休眠时间 (单位: 秒)
@param int $memoryLimit worker 内存限制 (单位: mb)