You are here

function background_process_set_service_host in Background Process 8

Same name and namespace in other branches
  1. 6 background_process.module \background_process_set_service_host()
  2. 7 background_process.module \background_process_set_service_host()

Implements to Set a service host for a background process.

1 call to background_process_set_service_host()
BackgroundProcess::dispatch in ./background_process.class.php
Implements to Dispatch Process.

File

./background_process.module, line 738
This module implements a framework for calling funtions in the background.

Code

function background_process_set_service_host($handle, $service_host) {
  try {
    $old_db = Database::setActiveConnection('background_process');
    $result = db_update('background_process')
      ->fields([
      'service_host' => $service_host ? $service_host : '',
    ])
      ->condition('handle', $handle)
      ->execute();
    Database::setActiveConnection($old_db);
    return $result;
  } catch (Exception $e) {
    Database::setActiveConnection($old_db);
    throw $e;
  }
}