/** * {@inheritDoc} */ public function peekReady($tube = null) { if ($this->dispatcher) { $this->dispatcher->dispatch(CommandEvent::PEEK_READY, new CommandEvent($this, ['tube' => $tube])); } return $this->pheanstalk->peekReady($tube); }
/** * Get the next job ready and buried in the specified tube and connection. * * @param PheanstalkInterface $pheanstalk * @param string $tubeName */ private function fetchJobs(PheanstalkInterface $pheanstalk, $tubeName) { try { $nextJobReady = $pheanstalk->peekReady($tubeName); $this->data['jobs'][$tubeName]['ready'] = ['id' => $nextJobReady->getId(), 'data' => $nextJobReady->getData()]; } catch (ServerException $e) { } try { $nextJobBuried = $pheanstalk->peekBuried($tubeName); $this->data['jobs'][$tubeName]['buried'] = ['id' => $nextJobBuried->getId(), 'data' => $nextJobBuried->getData()]; } catch (ServerException $e) { } }
/** * Get next ready job * * @return \Pheanstalk\Job * @throws \Pheanstalk\Exception */ public function peek() { return $this->pheanstalk->peekReady($this->tube); }