You are here

public function TaskManager::finishBatch in Search API 8

Finishes an "execute tasks" batch.

Parameters

bool $success: Indicates whether the batch process was successful.

array $results: Results information passed from the processing callback.

File

src/Task/TaskManager.php, line 389

Class

TaskManager
Provides a service for managing pending tasks.

Namespace

Drupal\search_api\Task

Code

public function finishBatch($success, array $results) {

  // Check if the batch job was successful.
  if ($success) {
    $message = $this
      ->formatPlural($results['total'], 'Successfully executed @count pending task.', 'Successfully executed @count pending tasks.');
    $this->messenger
      ->addStatus($message);
  }
  else {

    // Notify the user about the batch job failure.
    $this->messenger
      ->addError($this
      ->t('An error occurred while trying to execute tasks. Check the logs for details.'));
  }
}