public function JobExecutor::countJobs in Apigee Edge 8
Counts jobs in the queue.
Parameters
null|string $tag: Optional tag to filter with.
array|null $statuses: Optional statues to filter with.
Return value
int Number of counted jobs.
Overrides JobExecutorInterface::countJobs
File
- src/
JobExecutor.php, line 176
Class
- JobExecutor
- Job executor service.
Namespace
Drupal\apigee_edgeCode
public function countJobs(?string $tag = NULL, ?array $statuses = NULL) : int {
$query = $this->connection
->select('apigee_edge_job', 'j');
if ($tag !== NULL) {
$query
->condition('tag', $tag);
}
if ($statuses !== NULL) {
$query
->condition('status', $statuses, 'IN');
}
return (int) $query
->countQuery()
->execute()
->fetchField();
}