Return the size (number of pending jobs) of the specified queue.

@param $queue name of the queue to be checked for pending jobs

@return int The size of the queue.
426106
public function size($queue)
    {
        return $this->getClient()->llen($this->getKey(self::QUEUE_KEY . $queue));
    }
789523
public function size($queue = null)
    {
        $response = $this->sqs->getQueueAttributes([
            'QueueUrl' => $this->getQueue($queue),
            'AttributeNames' => ['ApproximateNumberOfMessages'],
        ]);

        $attributes = $response->get('Attributes');

        return (int) $attributes['ApproximateNumberOfMessages'];
    }
48706
public function getMessagesTotalCountOnQueue($queue)
    {
        try {
            return $this->queue->statsTube($queue)['total-jobs'];
        } catch (ConnectionException $ex) {
            \PHPUnit\Framework\Assert::fail("queue [$queue] not found");
        }
    }
581458
public function generateQueue($queue)
    {
        if (isset($this->queue[$queue->id])) {
            return $this->queue[$queue->id];
        }

        $history = Queue::where('queue_id', $queue->id)->get()->groupBy(function($item) {
            return $item->date->format('Y-m-d');
        })->map(function ($row) {
            return [
                'avg_wait_time' => $this->calculateAvg($row->sum('sonar_time'), $row->sum('sonar_count')),
                'avg_process_time' => $this->calculateAvg($row->sum('process_time'), $row->sum('process_count')),
                'total_process_count' => $row->sum('process_count'),
                'avg_pending_count' => round($row->avg('pending_count')),
                'idle_time' => $this->calculateTotal($row->sum('idle_time')),
                'exception_count' => $this->calculateTotal($row->sum('exception_count'))
            ];
        });

        // Fill the array gaps - because the chart wont populate correctly without 0 values
        for($i=14; $i>=0; $i--) {
            $this->queue[$queue->id]['day'][] = Carbon::now()->subDay($i)->format('d');

            if (isset($history[Carbon::now()->subDay($i)->format('Y-m-d')])) {
                $this->queue[$queue->id]['avg_wait_time'][] = $history[Carbon::now()->subDay($i)->format('Y-m-d')]['avg_wait_time'];
                $this->queue[$queue->id]['avg_process_time'][] = $history[Carbon::now()->subDay($i)->format('Y-m-d')]['avg_process_time'];
                $this->queue[$queue->id]['avg_pending_count'][] = $history[Carbon::now()->subDay($i)->format('Y-m-d')]['avg_pending_count'];
                $this->queue[$queue->id]['total_process_count'][] = $history[Carbon::now()->subDay($i)->format('Y-m-d')]['total_process_count'];
                $this->queue[$queue->id]['idle_time'][] = $history[Carbon::now()->subDay($i)->format('Y-m-d')]['idle_time'];
                $this->queue[$queue->id]['exception_count'][] = $history[Carbon::now()->subDay($i)->format('Y-m-d')]['exception_count'];
            } else {
                $this->queue[$queue->id]['avg_wait_time'][] = 0;
                $this->queue[$queue->id]['avg_process_time'][] = 0;
                $this->queue[$queue->id]['avg_pending_count'][] = 0;
                $this->queue[$queue->id]['total_process_count'][] = 0;
                $this->queue[$queue->id]['idle_time'][] = 0;
                $this->queue[$queue->id]['exception_count'][] = 0;
            }
        }

        return $this->queue[$queue->id];
    }
131053
public function getJobQueueBatchSize()
    {
        // If there's no batch size set, let's pull the batch size from the config
        if ($this->jQueueBatchSize === null) {
            $this->jQueueBatchSize = Config::get('concrete.limits.job_queue_batch');
        }

        return $this->jQueueBatchSize;
    }
1346311
public function countMessages($queueName)
    {
        list(, $messageCount) = $this->getChannel()->queue_declare($queueName, true);

        return $messageCount;
    }
389995
public function queue($queue = null)
    {
        return $this->mailer->queue($this->view, $this->data, $this->prepareCallback(), $queue);
    }
209216
public static function size(string $path) : ?int
    {
        $size = filesize($path);
        return $size === false ? null : $size;
    }
739934
public function size($queue = null)
    {
        return $this->getQueryBuilder()->from($this->table)
            ->where('queue', $this->getQueue($queue))
            ->count();
    }
1054709
synchronized int getSize( int priority ) {
    int size = 0;
    for (int i=priority; i<LEVEL; i++) {
      size += priorityQueues.get(i).size();
    }
    return size;
  }
609121
public function queueInfo()
    {
        if ($this->queueExists()) {
            $queueName = $this->getNameWithPrefix();
            $this->queue = $this->ironmq->getQueue($queueName);

            return $this->queue;
        }

        return null;
    }
542020
public function measuredQueues()
    {
        $queues = (array) $this->connection()->smembers('measured_queues');

        return collect($queues)->map(function ($class) {
            return preg_match('/queue:(.*)$/', $class, $matches) ? $matches[1] : $class;
        })->all();
    }
447834
public function pendingJobsCount($tube)
    {
        try {
            $count = $this->queue->table($this->table)
                                 ->whereNull('reserved_at')
                                 ->where('queue', $tube)
                                 ->where('available_at', '<=', time())
                                 ->count();
        } catch (QueryException $e) {
            $count = 0;
        }

        return $count;
    }
91643
public function size($queue = null)
    {
        return $this->database->table($this->table)
                    ->where('queue', $this->getQueue($queue))
                    ->count();
    }
299042
public function pendingJobsCount($tube)
    {
        try {
            $count = $this->queue->statsTube($tube)->{'current-jobs-ready'};
        } catch (ServerException $e) {
            $count = 0;
        }

        return $count;
    }
1268909
public static function redisKey($queue = null, $suffix = null)
    {
        if (is_null($queue)) {
            return 'queues';
        }

        return (strpos($queue, 'queue:') !== 0 ? 'queue:' : '').$queue.($suffix ? ':'.$suffix : '');
    }
1348533
public function getMessagesTotalCountOnQueue($queue)
    {
        try {
            return $this->queue->getQueue($queue)->total_messages;
        } catch (\Http_Exception $e) {
            \PHPUnit\Framework\Assert::fail("queue [$queue] not found");
        }
    }