You are here

public function BackgroundProcess::dispatch in Background Process 7.2

Same name and namespace in other branches
  1. 8 background_process.class.php \BackgroundProcess::dispatch()
  2. 6 BackgroundProcess.class.php \BackgroundProcess::dispatch()
  3. 7 BackgroundProcess.class.php \BackgroundProcess::dispatch()

Launch the process

2 calls to BackgroundProcess::dispatch()
BackgroundProcess::doKeepAlive in ./background_process.inc
Re-launch the process if necessary
BackgroundProcess::reDispatch in ./background_process.inc
If process has been locked for more than 10 seconds without starting then dispatch it again.

File

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

Class

BackgroundProcess
@file

Code

public function dispatch() {
  $this
    ->logDebug(__FUNCTION__ . ' - ' . $this->options['dispatcher']);

  // Ensure sanity
  $this
    ->ensureProcess();
  $this
    ->ensureServiceHost();
  $this
    ->ensureCleanup(FALSE, FALSE);

  // Update status and send message
  $this
    ->setStatus(BACKGROUND_PROCESS_STATUS_DISPATCHED)
    ->writeData();
  $this
    ->sendMessage('dispatch');
  module_invoke_all('background_process_pre_dispatch', $this);

  // Write data again, in case pre dispatch hook changed something
  $this
    ->writeData();
  background_process_invoke_dispatcher($this->options['dispatcher'], $this);
  module_invoke_all('background_process_post_dispatch', $this);
  return $this;
}