You are here

function job_scheduler_cron_queue_worker in Job Scheduler 7.2

Execute job worker from queue.

Providing our own worker has the advantage that we can reschedule the job or take care of cleanup Note that as we run the execute() action, the job won't be queued again this time.

1 string reference to 'job_scheduler_cron_queue_worker'
job_scheduler_cron_queue_info in ./job_scheduler.module
Implements hook_cron_queue_info().

File

./job_scheduler.module, line 259
Main file for the Job Scheduler.

Code

function job_scheduler_cron_queue_worker($job) {
  try {
    JobScheduler::get($job['name'])
      ->execute($job);
  } catch (Exception $e) {
    watchdog('job_scheduler', $e
      ->getMessage(), array(), WATCHDOG_ERROR);

    // Drop jobs that have caused exceptions.
    JobScheduler::get($job['name'])
      ->remove($job);
  }
}