Barryvdh\Queue\Console\AsyncCommand::processJob PHP Method

processJob() protected method

Process the job
protected processJob ( $connectionName, $id, $options )
    protected function processJob($connectionName, $id, $options)
    {
        $manager = $this->worker->getManager();
        $connection = $manager->connection($connectionName);
        $job = $connection->getJobFromId($id);
        // If we're able to pull a job off of the stack, we will process it and
        // then immediately return back out. If there is no job on the queue
        // we will "sleep" the worker for the specified number of seconds.
        if (!is_null($job)) {
            $sleep = max($job->getDatabaseJob()->available_at - time(), 0);
            sleep($sleep);
            return $this->worker->process($manager->getName($connectionName), $job, $options);
        }
        return ['job' => null, 'failed' => false];
    }