예제 #1
0
 /**
  * @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'];
 }
예제 #2
0
파일: JobQueueRedis.php 프로젝트: paladox/2
 /**
  * @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'];
 }
예제 #3
0
	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;
	}
예제 #4
0
 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;
 }