You are here

public function BackgroundProcess::reDispatch in Background Process 7.2

If process has been locked for more than 10 seconds without starting then dispatch it again.

File

./background_process.inc, line 680
External API short overview

Class

BackgroundProcess
@file

Code

public function reDispatch($threshold = 10) {

  // If process is locked and hasn't started for X seconds, then relaunch
  if ($this
    ->getStatus() == BACKGROUND_PROCESS_STATUS_LOCKED && $this
    ->getCreated() + $threshold <= time()) {
    $this
      ->logDebug(__FUNCTION__);
    $this
      ->dispatch();
    return TRUE;
  }

  // This is not re-dispatch?!? ... (re)move it!
  if ($this
    ->getStatus() == BACKGROUND_PROCESS_STATUS_LOCKED && $this
    ->getStartTime() + variable_get('background_process_cleanup_age', BACKGROUND_PROCESS_CLEANUP_AGE) <= time()) {
    $this
      ->shutdown();
    return FALSE;
  }
  return FALSE;
}