You are here

public function Lock::expire in Ultimate Cron 8.2

Release lock if expired.

Checks if expiration time has been reached, and releases the lock if so.

Parameters

string $job_id: The name of the lock.

Overrides LockInterface::expire

1 call to Lock::expire()
Lock::lock in src/Lock/Lock.php
Acquire lock.

File

src/Lock/Lock.php, line 107

Class

Lock
Class for handling lock functions.

Namespace

Drupal\ultimate_cron\Lock

Code

public function expire($job_id) {
  if ($lock_id = $this
    ->isLocked($job_id, TRUE)) {
    $now = microtime(TRUE);
    $this->connection
      ->update('ultimate_cron_lock')
      ->expression('current', 'lid')
      ->condition('lid', $lock_id)
      ->condition('expire', $now, '<=')
      ->execute();
  }
}