/** * Process the job * */ protected function processJob($connectionName, $id) { $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); } return ['job' => null, 'failed' => false]; }