You are here

public static function UltimateCronLock::reLock in Ultimate Cron 7.2

Relock.

Parameters

string $lock_id: The lock id to relock.

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

Return value

bool TRUE if relock was successful.

File

./ultimate_cron.lock.inc, line 137
A database-mediated implementation of a locking mechanism.

Class

UltimateCronLock
Class for handling lock functions.

Code

public static function reLock($lock_id, $timeout = 30.0) {
  $target = _ultimate_cron_get_transactional_safe_connection();

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