You are here

private function QueueService::commitReleasing in Purge 8.3

Commit all releasing invalidations in the buffer to the queue.

2 calls to QueueService::commitReleasing()
QueueService::claim in src/Plugin/Purge/Queue/QueueService.php
Claim invalidation objects from the queue.
QueueService::commit in src/Plugin/Purge/Queue/QueueService.php
Commit all actions in the internal buffer to the queue.

File

src/Plugin/Purge/Queue/QueueService.php, line 272

Class

QueueService
Provides the service that lets invalidations interact with a queue backend.

Namespace

Drupal\purge\Plugin\Purge\Queue

Code

private function commitReleasing() {
  $items = $this->buffer
    ->getFiltered(TxBuffer::RELEASING);
  if (!($items_count = count($items))) {
    return;
  }
  $this
    ->initializeQueue();
  if ($items_count === 1) {
    $invalidation = current($items);
    $this->queue
      ->releaseItem(new ProxyItem($invalidation, $this->buffer));
    $this->buffer
      ->set($invalidation, TxBuffer::RELEASED);
  }
  else {
    $proxyitems = [];
    foreach ($items as $item) {
      $proxyitems[] = new ProxyItem($item, $this->buffer);
    }
    $this->queue
      ->releaseItemMultiple($proxyitems);
    $this->buffer
      ->set($items, TxBuffer::RELEASED);
  }
  $this->purgeQueueStats
    ->updateTotals($items);
}