Copy queue items.

@param \SplPriorityQueue $queue
@return void
195314
protected function copyQueue(\SplPriorityQueue $queue)
    {
        $this->items = [];

        foreach ($queue as $item) {
            $this->items[] = $item;
        }
    }
1067636
public function removeQueue($queueName)
    {
        $queueUrl = $this->resolveUrl($queueName);

        $this->sqs->deleteQueue([
            'QueueUrl' => $queueUrl,
        ]);
    }
35542
public function bulk($jobs, $data = '', $queue = null)
    {
        foreach ((array) $jobs as $job) {
            $this->push($job, $data, $queue);
        }
    }
533596
protected function releaseJobsThatHaveBeenReservedTooLong($queue)
	{
		$expired = Carbon::now()->subSeconds($this->expire)->getTimestamp();

		$this->database->table($this->table)
					->where('queue', $this->getQueue($queue))
					->where('reserved', 1)
					->where('reserved_at', '<=', $expired)
					->update([
						'reserved' => 0,
						'reserved_at' => null,
						'attempts' => new Expression('attempts + 1'),
					]);
	}
451761
public function pop($queue = null)
    {
        if (static::supportDelayed()) {
            $this->requeueDelayedItems();
        }

        $queue = $queue ?: $this->queue;

        $job = Resque::pop($queue);

        if (!$job) {
            return null;
        }

        $message = new QueueMessage();

        $attempts = $job['attempts'];
        $attempts++;

        $message->setId($job['id']);
        $message->setBody($job);
        $message->setRawBody(json_encode($job));
        $message->setQueueName($queue ?: $this->queue);
        $message->setAttempts($attempts);
        $message->set('attempts', $attempts);

        return $message;
    }
1137098
public function push($queue, $item)
    {
        // Add the queue to the list of queues
        $this->getClient()->sadd($this->getKey(self::QUEUES_KEY), $queue);

        // Add the job to the specified queue
        $this->getClient()->rpush($this->getKey(self::QUEUE_KEY . $queue), json_encode($item));
    }
438035
public function enqueue($item): bool {
        if (!$this->isValid()) return false;

        $this->queue[$this->head] = $item;
        $this->head++;
        return true;
    }
1052204
protected function eyewitnessHeartbeat($queue)
    {
        if (! $this->cache->has('eyewitness_q_heartbeat_'.$queue->id)) {
            $this->cache->add('eyewitness_q_heartbeat_'.$queue->id, 1, 1);
            $queue->heartbeat();
        }
    }
726116
public function pop($queue = null)
    {
        $original = $queue ?: $this->default;

        $queue = $this->getQueue($queue);

        if (!is_null($this->expire)) {
            $this->migrateAllExpiredJobs($queue);
        }
        $job = $this->getConnection()->lPop($queue);

        if ($job) {
            $this->getConnection()->zAdd($queue . ':reserved', $this->getTime() + $this->expire, $job);

            return new PHPRedisJob($this->container, $this, $job, $original);
        }
    }
278110
public function copyFrom( MShop_Service_Item_Interface $service )
	{
		$this->setCode( $service->getCode() );
		$this->setName( $service->getName() );
		$this->setType( $service->getType() );
		$this->setServiceId( $service->getId() );

		$items = $service->getRefItems( 'media', 'default', 'default' );
		if( ( $item = reset( $items ) ) !== false ) {
			$this->setMediaUrl( $item->getUrl() );
		}

		$this->setModified();
	}
340115
public function deleteReserved($queue, $job)
    {
        $this->redis->zRem($this->getQueue($queue) . ':reserved', $job->getReservedJob());
    }
438420
public static function push($queue, $item)
    {
        self::redis()->sadd('queues', $queue);
        self::redis()->rpush('queue:' . $queue, json_encode($item));
    }
1073547
protected function migrateAllExpiredJobs($queue)
    {
        $this->migrateExpiredJobs($queue . ':delayed', $queue);

        $this->migrateExpiredJobs($queue . ':reserved', $queue);
    }
137622
public void setTargetQueue(String queue)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "setTargetQueue", queue);

    targetQueue = queue;

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "setTargetQueue");
  }
443578
public function pop($queue = null)
	{
		$queue = $this->getQueue($queue);

		if ( ! is_null($this->expire))
		{
			$this->releaseJobsThatHaveBeenReservedTooLong($queue);
		}

		if ($job = $this->getNextAvailableJob($queue))
		{
			$this->markJobAsReserved($job->id);

			$this->database->commit();

			return new DatabaseJob(
				$this->container, $this, $job, $queue
			);
		}

		$this->database->commit();
	}
291112
public function setQueueOptions(array $options = [], $queue = self::PRIORITY_NORM)
    {
        msg_set_queue($this->queues[$queue], $options);
    }
296589
public function clear()
    {
        $this->data = [];
        $this->expire = [];
        $this->ttl = [];

        $this->timer->stop();
        $this->queue = new \SplPriorityQueue();
    }