public function setTubeFromJob(BeanstalkdJob $job) { $stats = $this->pheanstalk->statsJob($job->getPheanstalkJob()); $this->tube = $stats->tube; }
/** * Get the number of times the job has been attempted. * * @return int */ public function attempts() { $stats = $this->pheanstalk->statsJob($this->job); return (int) $stats->reserves; }
/** * @param $jobId * * @return object|\Pheanstalk\Response */ public function findJob($jobId) { return $this->connection->statsJob($jobId); }
/** * @inheritdoc */ public function waitAndReserve($timeout = null) { if ($timeout === null) { $timeout = $this->defaultTimeout; } $pheanstalkJob = $this->client->reserveFromTube($this->name, $timeout); if ($pheanstalkJob === null || $pheanstalkJob === false) { return null; } $pheanstalkJobStats = $this->client->statsJob($pheanstalkJob); $numberOfReleases = isset($pheanstalkJobStats['reserves']) && $pheanstalkJobStats['reserves'] > 0 ? (int) $pheanstalkJobStats['reserves'] - 1 : 0; return new Message((string) $pheanstalkJob->getId(), json_decode($pheanstalkJob->getData(), true), $numberOfReleases); }