public function TaskManager::executeSpecificTask in Search API 8
Executes and deletes the given task.
Parameters
\Drupal\search_api\Task\TaskInterface $task: The task to execute.
Throws
\Drupal\search_api\SearchApiException Thrown if any error occurred while processing the task.
Overrides TaskManagerInterface::executeSpecificTask
3 calls to TaskManager::executeSpecificTask()
- TaskManager::executeAllTasks in src/Task/ TaskManager.php 
- Executes all (or some) pending tasks.
- TaskManager::executeSingleTask in src/Task/ TaskManager.php 
- Retrieves and executes a single task.
- TaskManager::processBatch in src/Task/ TaskManager.php 
- Processes a single pending task as part of a batch operation.
File
- src/Task/ TaskManager.php, line 210 
Class
- TaskManager
- Provides a service for managing pending tasks.
Namespace
Drupal\search_api\TaskCode
public function executeSpecificTask(TaskInterface $task) {
  $event = new TaskEvent($task);
  $this->eventDispatcher
    ->dispatch('search_api.task.' . $task
    ->getType(), $event);
  if (!$event
    ->isPropagationStopped()) {
    $id = $task
      ->id();
    $type = $task
      ->getType();
    throw new SearchApiException("Could not execute task #{$id} of type '{$type}'. Type seems to be unknown.");
  }
  if ($exception = $event
    ->getException()) {
    throw $exception;
  }
  $task
    ->delete();
}