You are here

public function LateRuntimeProcessor::onKernelFinishRequest in Purge 8.3

Invoked by the FINISH_REQUEST kernel event.

Parameters

\Symfony\Component\HttpKernel\Event\FinishRequestEvent $event: The event object.

File

modules/purge_processor_lateruntime/src/EventSubscriber/LateRuntimeProcessor.php, line 74

Class

LateRuntimeProcessor
Processes queue items at the end of every request.

Namespace

Drupal\purge_processor_lateruntime\EventSubscriber

Code

public function onKernelFinishRequest(FinishRequestEvent $event) {

  // Immediately stop if our plugin is disabled.
  if (!$this
    ->initialize()) {
    return;
  }

  // Claim a chunk of invalidations, process and let the queue handle results.
  $claims = $this->purgeQueue
    ->claim();
  try {
    $this->purgePurgers
      ->invalidate($this->processor, $claims);
  } catch (DiagnosticsException $e) {

    // Diagnostic exceptions happen when the system cannot purge.
  } catch (CapacityException $e) {

    // Capacity exceptions happen when too much was purged this request.
  } catch (LockException $e) {

    // Lock exceptions happen when another code path is currently processing.
  } finally {
    $this->purgeQueue
      ->handleResults($claims);
  }
}