You are here

public function ServerTaskManager::processEvent in Search API 8

Processes a single server task.

Parameters

\Drupal\search_api\Task\TaskEvent $event: The task event.

File

src/Task/ServerTaskManager.php, line 108

Class

ServerTaskManager
Provides a service for managing pending server tasks.

Namespace

Drupal\search_api\Task

Code

public function processEvent(TaskEvent $event) {
  $event
    ->stopPropagation();
  $task = $event
    ->getTask();
  try {
    if (!$this
      ->executeTask($task)) {
      $type = $task
        ->getType();
      throw new SearchApiException("Task of unknown type '{$type}' passed to server task manager.");
    }
  } catch (SearchApiException $e) {
    $event
      ->setException($e);
  }
}