Disque\Queue\Queue::pull PHP Method

pull() public method

Pulls a single job from the queue (if none available, and if $timeout specified, then wait only this much time for a job, otherwise return null)
public pull ( integer $timeout ) : Disque\Queue\Job | null
$timeout integer If specified, wait these many seconds
return Disque\Queue\Job | null A job, or null if no job was found before timeout
    public function pull($timeout = 0)
    {
        $this->checkConnected();
        $jobs = $this->client->getJob($this->name, ['timeout' => $timeout, 'count' => 1, 'withcounters' => true]);
        if (empty($jobs)) {
            return null;
        }
        $jobData = $jobs[0];
        $job = $this->marshaler->unmarshal($jobData[Response::KEY_BODY]);
        $job->setId($jobData[Response::KEY_ID]);
        $job->setNacks($jobData[Counters::KEY_NACKS]);
        $job->setAdditionalDeliveries($jobData[Counters::KEY_ADDITIONAL_DELIVERIES]);
        return $job;
    }