public function DatabaseQueue::garbageCollection in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Queue/DatabaseQueue.php \Drupal\Core\Queue\DatabaseQueue::garbageCollection()
- 9 core/lib/Drupal/Core/Queue/DatabaseQueue.php \Drupal\Core\Queue\DatabaseQueue::garbageCollection()
File
- core/lib/Drupal/Core/Queue/DatabaseQueue.php, line 240
Class
- DatabaseQueue
- Default queue implementation.
Namespace
Drupal\Core\Queue
Code
public function garbageCollection() {
try {
$this->connection
->delete(static::TABLE_NAME)
->condition('created', \Drupal::time()
->getRequestTime() - 864000, '<')
->condition('name', 'drupal_batch:%', 'LIKE')
->execute();
$this->connection
->update(static::TABLE_NAME)
->fields([
'expire' => 0,
])
->condition('expire', 0, '<>')
->condition('expire', \Drupal::time()
->getRequestTime(), '<')
->execute();
} catch (\Exception $e) {
$this
->catchException($e);
}
}