You are here

function notifications_process_run in Notifications 5

Same name and namespace in other branches
  1. 6 notifications.cron.inc \notifications_process_run()
  2. 6.2 notifications.cron.inc \notifications_process_run()
  3. 6.3 notifications.cron.inc \notifications_process_run()

Function to be called on cron by the main notifications_cron

It will call each subscription_process for each interval a number of times

This should send out messages starting with immediate delivery. We send first immediate delivery because the other ones can be added up for each period. Assumption: The bigger the interval, the longer delay it may admit (?) I.e. sending hourly email after 1 hour 15 mins may be ok if the system is overloaded.

2 calls to notifications_process_run()
notifications_admin_queue_process in ./notifications.admin.inc
Admin manual queue processing
notifications_cron in ./notifications.module
Implementation of hook_cron()

File

./notifications.cron.inc, line 31

Code

function notifications_process_run($cron = TRUE) {
  notifications_log('Starting queue process');
  notifications_process('start');

  // There may be special time adjustments for cron
  if ($cron) {
    notifications_process('cron');
  }
  $stop = FALSE;
  $send_intervals = _notifications_send_intervals();
  unset($send_intervals[-1]);
  $max_sqid = notifications_process_prepare();
  foreach ($send_intervals as $interval => $name) {
    notifications_log('Processing send interval ' . $name);
    while (notifications_process_queue($interval, $max_sqid)) {
      $stop = !notifications_process('check');
    }
    if ($stop) {
      notifications_log('Process stopped');
      break;
    }
  }
}