You are here

protected function AcquiaPurgeQueueSmart::expireQueueItems in Acquia Purge 7

Expire queue items that should have already expired externally.

2 calls to AcquiaPurgeQueueSmart::expireQueueItems()
AcquiaPurgeQueueSmart::claimItem in lib/queue/AcquiaPurgeQueueSmart.php
SystemQueue::claimItem() doesn't included expired items in its query which means that it essentially breaks its own interface promise. Therefore we overload the implementation with one that does do this accurately. This should however flow back…
AcquiaPurgeQueueSmart::claimItemMultiple in lib/queue/AcquiaPurgeQueueSmart.php
Claims multiple items from the queue for processing.

File

lib/queue/AcquiaPurgeQueueSmart.php, line 38
Contains SmartQueue.

Class

AcquiaPurgeQueueSmart
Efficient query bundling database queue that disregards expired queue items.

Code

protected function expireQueueItems() {

  // Do not bother expiry under the following conditions.
  $expired = time() - 2 * $this->ttl;
  if ($this->ttl < 20) {
    return;
  }
  if ($expired < 1 || $expired >= time()) {
    return;
  }

  // Delete items from the queue that expired and need no processing by AP.
  $deleted_items = db_delete('queue')
    ->condition('name', $this->name)
    ->condition('created', $expired, '<')
    ->execute();
  if ($deleted_items > 0) {
    watchdog('acquia_purge', "Disregarded %n expired items from the queue (smart queue backend).", array(
      '%n' => $deleted_items,
    ), WATCHDOG_INFO);
    $this
      ->total()
      ->decrease($deleted_items);
  }
}