You are here

public static function DeveloperSyncController::batchExecuteJobs in Apigee Edge 8

The second batch operation.

Parameters

string $tag: Job tag.

array $context: Batch context.

File

src/Controller/DeveloperSyncController.php, line 183

Class

DeveloperSyncController
Controller for the developer synchronization-related pages.

Namespace

Drupal\apigee_edge\Controller

Code

public static function batchExecuteJobs(string $tag, array &$context) {
  if (!isset($context['sandbox'])) {
    $context['sandbox'] = [];
  }
  $executor = apigee_edge_get_executor();
  $job = $executor
    ->select($tag);
  if ($job === NULL) {
    $context['finished'] = 1.0;
    return;
  }
  $executor
    ->call($job);
  $context['message'] = (string) $job;
  $context['finished'] = $executor
    ->countJobs($tag, [
    Job::FAILED,
    Job::FINISHED,
  ]) / $executor
    ->countJobs($tag);
}