***********************************\
|*              Queues               *|
\************************************ Get all queued items
327728
function queue(customParams, callback) {
      var _doArgs47 = doArgs(arguments, [['object', {}], 'function']);

      var _doArgs48 = _slicedToArray(_doArgs47, 2);

      customParams = _doArgs48[0];
      callback = _doArgs48[1];


      doRequest({
        urlPattern: [QUEUE]
      }, customParams, callback);
    }
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();
    }
1334629
function Queue( subQueues ) {
  subQueues = subQueues || [];
  subQueues.push('default');
  subQueues = _.uniq(subQueues);

  this.queueNames = subQueues;
  this.__queues__ = {};

  subQueues.forEach(function( name ) {
    this.__queues__[name] = new SubQueue();
  }.bind(this));
}
1028583
def enqueue(trg_queue, item_f, *args, **kwargs):
    '''
    '''
    return venqueue(trg_queue, item_f, args, **kwargs)
802417
public function getStats()
    {
        $result = [
            self::STATS_QUEUES_LIST   => [],
            self::STATS_JOBS_TOTAL    => 0,
            self::STATS_JOBS_READY    => 0,
            self::STATS_JOBS_RESERVED => 0,
            self::STATS_JOBS_DELAYED  => 0,
            self::STATS_JOBS_BURIED   => 0,
        ];

        $queueList = $this->getQueueNames();
        if (count($queueList) == 0) {
            return $result;
        }

        $result[self::STATS_QUEUES_LIST] = $queueList;

        foreach ($queueList as $queueName) {
            $itemStats = $this->getQueueInfo($queueName);
            $result[self::STATS_JOBS_READY] += $itemStats[self::STATS_JOBS_READY];
            $result[self::STATS_JOBS_RESERVED] += $itemStats[self::STATS_JOBS_RESERVED];
            $result[self::STATS_JOBS_DELAYED] += $itemStats[self::STATS_JOBS_DELAYED];
            $result[self::STATS_JOBS_BURIED] += $itemStats[self::STATS_JOBS_BURIED];
            $result[self::STATS_JOBS_TOTAL] += $itemStats[self::STATS_JOBS_TOTAL];
            $result[self::STATS_QUEUES][$queueName] = $itemStats;
        }

        return $result;
    }
1168600
def find_item(self):
        '''
        
        '''
        random.shuffle(self.queue_keys)
        count = 0

        while count <= self.item_retries:
            for key in self.queue_keys:
                # skip if the whole domain has been blacklisted in zookeeper
                if key.split(':')[1] in self.black_domains:
                    continue
                # the throttled queue only returns an item if it is allowed
                item = self.queue_dict[key][0].pop()

                if item:
                    # update timeout and return
                    self.queue_dict[key][1] = time.time()
                    return item

            count = count + 1

        return None
1122643
function() {
        var queue = this._queue;
        for (var i = 0, len = queue.length; i < len; ++i) {
            this[queue[i][0]].apply(this, queue[i][1]);
        }
    }
1073705
function getCollection(items, query, cb, argsLength) {
  var skip = 0, limit = Number.MAX_SAFE_INTEGER;
  setImmediate(function() {
    if (argsLength === 1) {
      cb = query;
    } else {
      skip = (query.skip) ? query.skip : 0;
      limit = (query.limit) ? query.limit : Number.MAX_SAFE_INTEGER;
    }
    var sortedKeys = Object.keys(items);
    var qKeys = remove(remove(Object.keys(query), /skip/), /limit/);
    qKeys.forEach(function (k) {
      try {
        var re = new RegExp(query[k]);
        sortedKeys = sortedKeys.filter(function (l) {
          return items[l][k].toString().match(re);
        });
      } catch (e) {
        console.error(`Problem filtering collection for parameter ${k}.`,
          e.message);
      }
    });
    skip = checkSkip(skip, sortedKeys);
    limit = checkLimit(limit, sortedKeys);
    if (sortedKeys.length === 0 || limit === 0 || skip >= sortedKeys.length) {
      return cb(null, [], sortedKeys.length, 1, 1, 0);
    }
    var pages = Math.ceil(sortedKeys.length / limit);
    var pageOf = Math.ceil(skip / limit) + 1;
    var itemArray = new Array();
    for ( var x = skip ; x < Math.min(skip + limit, sortedKeys.length) ; x++ ) {
      itemArray.push(items[sortedKeys[x]]);
    }
    cb(null, itemArray, sortedKeys.length, pageOf, pages, itemArray.length);
  });
}
467515
def _get_all(self):
        ''' 
        '''
        rowid = 0
        while True:
            SQL_SELECT_MANY = 'SELECT rowid, * FROM %s WHERE rowid > ? LIMIT ?;' % self._table
            self._cursor.execute(SQL_SELECT_MANY, (rowid, ITEMS_PER_REQUEST))
            items = self._cursor.fetchall()
            if len(items) == 0:
                break
            for item in items:
                rowid = item['_id']
                yield self._make_item(item)
284890
public function processQueue()
    {
        //Set items to 0
        $this->totalItems = 0;

        //Set bulk sync limit
        $this->bulkSyncLimit = 5;

        //Set priority
        $this->_setPriority();

        //Check previous import status
        $this->_checkImportStatus();

        //Bulk priority. Process group 1 first
        foreach ($this->bulkPriority as $bulk) {
            if ($this->totalItems < $bulk['limit']) {
                $collection = $this->_getQueue(
                    $bulk['type'],
                    $bulk['mode'],
                    $bulk['limit'] - $this->totalItems
                );
                if ($collection->getSize()) {
                    $this->totalItems += $collection->getSize();
                    $bulkModel = $this->objectManager->create($bulk['model']);
                    $bulkModel->sync($collection);
                }
            }
        }

        //reset total items to 0
        $this->totalItems = 0;

        //Single/Update priority.
        foreach ($this->singlePriority as $single) {
            if ($this->totalItems < $single['limit']) {
                $collection = $this->_getQueue(
                    $single['type'],
                    $single['mode'],
                    $single['limit'] - $this->totalItems
                );
                if ($collection->getSize()) {
                    $this->totalItems += $collection->getSize();
                    $singleModel = $this->objectManager->create(
                        $single['model']
                    );
                    $singleModel->sync($collection);
                }
            }
        }
    }
943261
protected static void checkQueues(final Iterable<String> queues) {
        if (queues == null) {
            throw new IllegalArgumentException("queues must not be null");
        }
        for (final String queue : queues) {
            if (queue == null || "".equals(queue)) {
                throw new IllegalArgumentException("queues' members must not be null: " + queues);
            }
        }
    }
184065
def get_nowait_from_queue(queue):
    
    data = []
    for _ in range(queue.qsize()):
        try:
            data.append(queue.get_nowait())
        except q.Empty:
            break
    return data
273665
function(options) {
            this.queue.defer(function() {
                options = _.defaults(options || {}, {
                    refresh: false
                });
                var d, self = this;

                if (this.options.loader == null) return this;
                if (options.refresh) {
                    this.options.startIndex = 0;
                    this._totalCount = null;
                    this.reset([]);
                }

                if (this._totalCount == null || this.hasMore() > 0 || options.refresh) {
                    this.options.startIndex = this.options.startIndex || 0;
                    d = Q(this[this.options.loader].apply(this, this.options.loaderArgs || []));
                    d.done(function() {
                        self.options.startIndex = self.options.startIndex + self.options.limit
                    });
                } else {
                    d = Q.reject();
                }

                return d;
            }, this);

            return this;
        }
658476
function enqueue(){
		var tasks = argumentFilter(arguments);
		queued.push({ tasks:tasks });
		// Timeout needed to increment expected, if next item exists.
		// If it run without timeout, expected always be 0 and the functions
		// will be executed immediately obtaining undefined as parameter.
		setTimeout(function(){if (! expected) runQueue();},1);
		return enqueue;
	}
181841
public java.util.List<Queue> getQueues() {
        if (queues == null) {
            queues = new com.amazonaws.internal.SdkInternalList<Queue>();
        }
        return queues;
    }
107095
async function fetchAll(connection, query, params){

    // execute query
    const [result] = await _query(connection, query, params);

    // entry found ?
    return result || [];
}
236661
public function getQueues()
    {
        $queueNames = [];
        $queues = $this->queue->listQueues(['QueueNamePrefix' => ''])->get('QueueUrls');
        foreach ($queues as $queue) {
            $tokens = explode('/', $queue);
            $queueNames[] = $tokens[sizeof($tokens) - 1];
        }
        return $queueNames;
    }