You are here

protected function JobExecutor::ensure in Apigee Edge 8

Ensures that a job exists with a given status.

Parameters

\Drupal\apigee_edge\Job\Job $job: Job object.

int $status: Job status.

2 calls to JobExecutor::ensure()
JobExecutor::call in src/JobExecutor.php
Executes a job synchronously.
JobExecutor::select in src/JobExecutor.php
Claims a job if one is available.

File

src/JobExecutor.php, line 77

Class

JobExecutor
Job executor service.

Namespace

Drupal\apigee_edge

Code

protected function ensure(Job $job, int $status) {
  if ($job
    ->getStatus() !== $status) {
    $job
      ->setStatus($status);
    $this
      ->save($job);
  }
}