/** * @see JobQueue::isRootJobOldDuplicate() * @param Job $job * @return bool */ protected function doIsRootJobOldDuplicate(Job $job) { if (!$job->hasRootJobParams()) { return false; // job has no de-deplication info } $params = $job->getRootJobParams(); $key = $this->getRootJobCacheKey($params['rootJobSignature']); // Get the last time this root job was enqueued $timestamp = $this->dupCache->get($key); // Check if a new root job was started at the location after this one's... return $timestamp && $timestamp > $params['rootJobTimestamp']; }
/** * @see JobQueue::doIsRootJobOldDuplicate() * @param Job $job * @return bool * @throws JobQueueError */ protected function doIsRootJobOldDuplicate(Job $job) { if (!$job->hasRootJobParams()) { return false; // job has no de-deplication info } $params = $job->getRootJobParams(); $conn = $this->getConnection(); try { // Get the last time this root job was enqueued $timestamp = $conn->get($this->getRootJobCacheKey($params['rootJobSignature'])); } catch (RedisException $e) { $timestamp = false; $this->throwRedisException($conn, $e); } // Check if a new root job was started at the location after this one's... return $timestamp && $timestamp > $params['rootJobTimestamp']; }
protected function doDeduplicateRootJob( Job $job ) { $params = $job->getRootJobParams(); $partitions = $this->partitionPushRing->getLocations( $params['rootJobSignature'], 2 ); try { return $this->partitionQueues[$partitions[0]]->doDeduplicateRootJob( $job ); } catch ( JobQueueError $e ) { if ( isset( $partitions[1] ) ) { // check fallback partition return $this->partitionQueues[$partitions[1]]->doDeduplicateRootJob( $job ); } } return false; }
protected function doIsRootJobOldDuplicate(Job $job) { $params = $job->getRootJobParams(); $sigature = $params['rootJobSignature']; $partition = $this->partitionRing->getLiveLocation($sigature); try { return $this->partitionQueues[$partition]->doIsRootJobOldDuplicate($job); } catch (JobQueueError $e) { if ($this->partitionRing->ejectFromLiveRing($partition, 5)) { $partition = $this->partitionRing->getLiveLocation($sigature); return $this->partitionQueues[$partition]->doIsRootJobOldDuplicate($job); } } return false; }