You are here

public function ComputingQueue::numberOfItems in Drupal Computing 7.2

Retrieve the number of items in the queue.

This is intended to provide a "best guess" count of the number of items in the queue. Depending on the implementation and the setup, the accuracy of the results of this function may vary.

e.g. On a busy system with a large number of consumers and items, the result might only be valid for a fraction of a second and not provide an accurate representation.

Return value

An integer estimate of the number of items in the queue.

Overrides DrupalQueueInterface::numberOfItems

File

./computing.queue.inc, line 43

Class

ComputingQueue
This file provides Queue support, an extra layer to handle computing records. The only benefit here is to provide an interface for Queue, perhaps people don't need it.

Code

public function numberOfItems() {
  return db_query("SELECT COUNT(id) FROM {computing_record} WHERE application = :name AND status = 'RDY'", array(
    ':name' => $this->app_name,
  ))
    ->fetchField();
}