function sf_notifications_cron in Salesforce Suite 7.2
Implements hook_cron().
We claim an item for 60 seconds. If it processes, we remove it from the queue. If it doesn't, we leave it. We don't relinquish the claim so we can move past it and continue processing other queue items. We log a watchdog items for the admin's notice.
File
- sf_notifications/
sf_notifications.module, line 498
Code
function sf_notifications_cron() {
// Release any expired claims so they are available to be re-claimed.
sf_notifications_release_expired_claims();
$queue = DrupalQueue::get('sf_notifications_queue');
$end = time() + 60;
while (time() < $end && ($item = $queue
->claimItem(60))) {
$ret = _sf_notifications_parse_handle_message($item->data);
if ($ret) {
salesforce_api_log(SALESFORCE_LOG_SOME, 'Queued notification processed. Contents: <pre>%content</pre>', array(
'%content' => print_r($item->data, TRUE),
));
$queue
->deleteItem($item);
}
else {
salesforce_api_log(SALESFORCE_LOG_ALL, 'Queued notification processing failed. Contents: <pre>%content</pre>', array(
'%content' => print_r($item->data, TRUE),
), WATCHDOG_ERROR);
}
}
}