Illuminate\Queue\Worker::daemonShouldRun PHP Method

daemonShouldRun() protected method

Determine if the daemon should process on this iteration.
protected daemonShouldRun ( WorkerOptions $options ) : boolean
$options WorkerOptions
return boolean
    protected function daemonShouldRun(WorkerOptions $options)
    {
        if ($this->manager->isDownForMaintenance() && !$options->force || $this->events->until('illuminate.queue.looping') === false) {
            // If the application is down for maintenance or doesn't want the queues to run
            // we will sleep for one second just in case the developer has it set to not
            // sleep at all. This just prevents CPU from maxing out in this situation.
            $this->sleep(1);
            return false;
        }
        return true;
    }