You are here

public function Lock::reLock in Ultimate Cron 8.2

Relock.

Parameters

string $lock_id: The lock id to relock.

float $timeout: The timeout in seconds for the lock.

Return value

boolean TRUE if relock was successful.

Overrides LockInterface::reLock

File

src/Lock/Lock.php, line 145

Class

Lock
Class for handling lock functions.

Namespace

Drupal\ultimate_cron\Lock

Code

public function reLock($lock_id, $timeout = 30.0) {

  // Ensure that the timeout is at least 1 ms.
  $timeout = max($timeout, 0.001);
  $expire = microtime(TRUE) + $timeout;
  return (bool) $this->connection
    ->update('ultimate_cron_lock')
    ->fields(array(
    'expire' => $expire,
  ))
    ->condition('lid', $lock_id)
    ->condition('current', 0)
    ->execute();
}