function Notifications_Queue::process_run in Notifications 6.4
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.
Return value
int Number of rows processed
1 call to Notifications_Queue::process_run()
- Notifications_Queue::process_cron in includes/
notifications_queue.class.inc - Callback for Drupal cron
File
- includes/
notifications_queue.class.inc, line 88
Class
- Notifications_Queue
- Queue management and processing
Code
function process_run() {
notifications_log('Starting notifications process');
$count = 0;
$stop = FALSE;
$send_intervals = _notifications_send_intervals();
unset($send_intervals[-1]);
if ($max_sqid = $this
->process_prepare()) {
foreach ($send_intervals as $interval => $name) {
notifications_log('Processing queue', array(
'send interval' => $name,
));
while ($rows = $this
->process_queue($interval, $max_sqid)) {
$count += $rows;
$stop = !$this
->process_control('check');
}
if ($stop) {
notifications_log('Process stopped, reached processing limits');
break;
}
else {
notifications_log('Process finished', array(
'send interval' => $name,
));
}
}
}
else {
notifications_log('No rows in queue');
}
$this
->process_control('stop');
return $count;
}