DatabaseQueue::numberOfItems

public DatabaseQueue::numberOfItems() Retrieves 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 t

DatabaseQueue::garbageCollection

public DatabaseQueue::garbageCollection() Cleans queues of garbage. Overrides QueueGarbageCollectionInterface::garbageCollection File core/lib/Drupal/Core/Queue/DatabaseQueue.php, line 215 Class DatabaseQueue Default queue implementation. Namespace Drupal\Core\Queue Code public function garbageCollection() { try { // Clean up the queue for failed batches. $this->connection->delete(static::TABLE_NAME) ->condition('created', REQUEST_TIME - 864000, '<') -

DatabaseQueue::ensureTableExists

protected DatabaseQueue::ensureTableExists() Check if the table exists and create it if not. File core/lib/Drupal/Core/Queue/DatabaseQueue.php, line 241 Class DatabaseQueue Default queue implementation. Namespace Drupal\Core\Queue Code protected function ensureTableExists() { try { $database_schema = $this->connection->schema(); if (!$database_schema->tableExists(static::TABLE_NAME)) { $schema_definition = $this->schemaDefinition(); $database_schema-&g

DatabaseQueue::doCreateItem

protected DatabaseQueue::doCreateItem($data) Adds a queue item and store it directly to the queue. Parameters $data: Arbitrary data to be associated with the new task in the queue. Return value A unique ID if the item was successfully created and was (best effort) added to the queue, otherwise FALSE. We don't guarantee the item was committed to disk etc, but as far as we know, the item is now in the queue. File core/lib/Drupal/Core/Queue/DatabaseQueue.php, line 85 Class DatabaseQueue Def

DatabaseQueue::deleteQueue

public DatabaseQueue::deleteQueue() Deletes a queue and every item in the queue. Overrides QueueInterface::deleteQueue File core/lib/Drupal/Core/Queue/DatabaseQueue.php, line 201 Class DatabaseQueue Default queue implementation. Namespace Drupal\Core\Queue Code public function deleteQueue() { try { $this->connection->delete(static::TABLE_NAME) ->condition('name', $this->name) ->execute(); } catch (\Exception $e) { $this->catchException($e);

DatabaseQueue::deleteItem

public DatabaseQueue::deleteItem($item) Deletes a finished item from the queue. Parameters $item: The item returned by \Drupal\Core\Queue\QueueInterface::claimItem(). Overrides QueueInterface::deleteItem File core/lib/Drupal/Core/Queue/DatabaseQueue.php, line 179 Class DatabaseQueue Default queue implementation. Namespace Drupal\Core\Queue Code public function deleteItem($item) { try { $this->connection->delete(static::TABLE_NAME) ->condition('item_id', $item->

DatabaseQueue::createQueue

public DatabaseQueue::createQueue() Creates a queue. Called during installation and should be used to perform any necessary initialization operations. This should not be confused with the constructor for these objects, which is called every time an object is instantiated to operate on a queue. This operation is only needed the first time a given queue is going to be initialized (for example, to make a new database table or directory to hold tasks for the queue -- it depends on the queue impleme

DatabaseQueue::createItem

public DatabaseQueue::createItem($data) Adds a queue item and store it directly to the queue. Parameters $data: Arbitrary data to be associated with the new task in the queue. Return value A unique ID if the item was successfully created and was (best effort) added to the queue, otherwise FALSE. We don't guarantee the item was committed to disk etc, but as far as we know, the item is now in the queue. Overrides QueueInterface::createItem File core/lib/Drupal/Core/Queue/DatabaseQueue.php, line

DatabaseQueue::claimItem

public DatabaseQueue::claimItem($lease_time = 30) Claims an item in the queue for processing. Parameters $lease_time: How long the processing is expected to take in seconds, defaults to an hour. After this lease expires, the item will be reset and another consumer can claim the item. For idempotent tasks (which can be run multiple times without side effects), shorter lease times would result in lower latency in case a consumer fails. For tasks that should not be run more than once (non-idempot

DatabaseQueue::catchException

protected DatabaseQueue::catchException(\Exception $e) Act on an exception when queue might be stale. If the table does not yet exist, that's fine, but if the table exists and yet the query failed, then the queue is stale and the exception needs to propagate. Parameters $e: The exception. Throws \Exception If the table exists the exception passed in is rethrown. File core/lib/Drupal/Core/Queue/DatabaseQueue.php, line 272 Class DatabaseQueue Default queue implementation. Namespace Drup