You are here

public function Database::cleanupQueue in Advanced Queue 8

Cleans up the queue.

Called by the queue runner before jobs are processed.

Overrides BackendBase::cleanupQueue

File

src/Plugin/AdvancedQueue/Backend/Database.php, line 80

Class

Database
Provides the database queue backend.

Namespace

Drupal\advancedqueue\Plugin\AdvancedQueue\Backend

Code

public function cleanupQueue() {

  // Reset expired jobs.
  $this->connection
    ->update('advancedqueue')
    ->fields([
    'state' => Job::STATE_QUEUED,
    'expires' => 0,
  ])
    ->condition('expires', 0, '<>')
    ->condition('expires', $this->time
    ->getCurrentTime(), '<')
    ->execute();
}