db_ignore_slave

Versions
7
db_ignore_slave()

Helper function to get duration lag from variable and set the session variable that contains the lag.

▾ 2 functions call db_ignore_slave()

comment_save in modules/comment/comment.module
Accepts a submission of new or changed comment content.
node_save in modules/node/node.module
Save changes to a node or add a new node.

Code

includes/database/database.inc, line 2602

<?php
function db_ignore_slave() {
  $connection_info = Database::getConnectionInfo();
  // Only set ignore_slave_server if there are slave servers
  // being used, which is assumed if there are more than one.
  if (count($connection_info) > 1) {
    // Five minutes is long enough to allow the slave to break and resume
    // interrupted replication without causing problems on the Drupal site
    // from the old data.
    $duration = variable_get('maximum_replication_lag', 300);
    // Set session variable with amount of time to delay before using slave.
    $_SESSION['ignore_slave_server'] = REQUEST_TIME + $duration;
  }
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.