You are here

public function AcquiaPurgeQueueEfficient::releaseItemMultiple in Acquia Purge 7

Release multiple items that the worker could not process.

Another worker can come in and process these before the timeout expires.

Parameters

array $items: Non-associative array with item objects as returned by claimItemMultiple() or DrupalQueueInterface::claimItem().

Return value

array Empty array upon full success, else the remaining items that failed.

Overrides AcquiaPurgeQueueInterface::releaseItemMultiple

File

lib/queue/AcquiaPurgeQueueEfficient.php, line 239
Contains EfficientQueue.

Class

AcquiaPurgeQueueEfficient
Efficient query bundling database queue.

Code

public function releaseItemMultiple(array $items) {
  if (empty($items)) {
    return array();
  }
  $item_ids = array();
  foreach ($items as $item) {
    $item_ids[] = $item->item_id;
  }
  $update = db_update('queue')
    ->fields(array(
    'expire' => 0,
  ))
    ->condition('item_id', $item_ids, 'IN')
    ->execute();
  if ($update) {
    $this
      ->bad()
      ->increase(count($item_ids));
    return array();
  }
  else {
    return $items;
  }
}