You are here

public function SignalCache::get in Ultimate Cron 8.2

Get and claim signal.

Parameters

string $name: The name of the job.

string $signal: The name of the signal.

Return value

string The signal if any. If a signal is found, it is "claimed" and therefore cannot be claimed again.

Overrides SignalInterface::get

File

src/Signal/SignalCache.php, line 60

Class

SignalCache

Namespace

Drupal\ultimate_cron\Signal

Code

public function get($job_id, $signal) {
  if ($this->lockBackend
    ->acquire("signal-{$job_id}-{$signal}")) {
    $result = self::peek($job_id, $signal);
    self::clear($job_id, $signal);
    $this->lockBackend
      ->release("signal-{$job_id}-{$signal}");
    return $result;
  }
  return FALSE;
}