You are here

function Notifications_Queue::process_prepare in Notifications 6.4

Prepare subscriptions queue

This is intended to avoid race conditions where new rows are added while the process is running

Return value

Max $sqid that will be processed this cron

3 calls to Notifications_Queue::process_prepare()
Notifications_Queue::process_cron in includes/notifications_queue.class.inc
Callback for Drupal cron
Notifications_Queue::process_queue in includes/notifications_queue.class.inc
Process subscriptions queue
Notifications_Queue::process_run in includes/notifications_queue.class.inc
Function to be called on cron by the main notifications_cron

File

includes/notifications_queue.class.inc, line 125

Class

Notifications_Queue
Queue management and processing

Code

function process_prepare() {
  if (!isset($this->process_max_sqid)) {
    $this
      ->process_control('start');

    // This will get the latest notification in queue so we don't mess with new ones being created during cron run
    // It will also prevent clashes with the immediate sending feature
    $this->process_max_sqid = db_result(db_query("SELECT max(sqid) FROM {notifications_queue}"));
  }
  return $this->process_max_sqid;
}