You are here

protected function QueueMongodb::garbageCollection in MongoDB 8

Automatically release items, that have been claimed and exceeded lease time.

2 calls to QueueMongodb::garbageCollection()
BatchQueueMongodb::claimItem in src/BatchQueueMongodb.php
Claim an item in the queue for processing.
QueueMongodb::claimItem in src/QueueMongodb.php
Claim an item in the queue for processing.

File

src/QueueMongodb.php, line 102
Contains \Drupal\mongodb\QueueMongodb

Class

QueueMongodb
MongoDB queue implementation.

Namespace

Drupal\mongodb

Code

protected function garbageCollection() {
  $this
    ->mongoCollection()
    ->update(array(
    'expire' => array(
      '$gt' => 0,
      '$lt' => REQUEST_TIME,
    ),
  ), array(
    '$set' => array(
      'expire' => 0,
    ),
  ), array(
    'multiple' => TRUE,
  ));
}