Drupal Queue integration in Job Scheduler for Drupal 6 is quirky: it expects the API user to declare a Drupal Queue of the same name as the callback of the job schedule and thus choose whether a job callback should be executed by the job scheduler or merely queued for later execution.

This needs to be fixed and is actually a bug, because it confuses the concepts of queue name with callback functions.

Patch coming.

Members fund testing for the Drupal project. Drupal Association Learn more


alex_b’s picture

This fixes the abovementioned issues for Drupal 7. Most importantly, job schedules need to be declared in a hook now, this is in analogy to how drupal's queue works. Compare this hook to hook_cron_queue_info().

 * Declare job scheduling holding items that need to be run periodically.
 * @return
 *   An associative array where the key is the queue name and the value is
 *   again an associative array. Possible keys are:
 *   - 'worker callback': The name of the function to call. It will be called
 *     at schedule time.
 *   - 'queue name': The name of the queue to use to queue this task. Must
 *     contain a valid queue name, declared by hook_cron_queue_info().
 *   If queue name is given, worker callback will be ignored.
 * @see hook_cron_job_schedule_info_alter()
 * @see hook_cron_queue_info()
 * @see hook_cron_queue_info_alter()
function hook_cron_job_schedule_info() {
  $queues['import'] = array(
    'worker callback' => 'my_import_routine',
  $queues['clear caches'] = array(
    'queue name' => 'my_cache_clear_queue',
  return $queues;
alex_b’s picture

Status: Active » Needs review
8.17 KB

Improves the example in the hook documentation.

alex_b’s picture

Further unify concepts of queue and scheduler.

- One object per scheduler identified by $name.
- Hence, move cron dispatching routine out of class into module.
- JobScheduler::get($name) instead of job_scheduler($name).

Also updated README.txt and job_scheduler.api.php accordingly.

alex_b’s picture

- Fix a couple of typos.
- Remove semaphore. The scheduling routine being time based plus the recovery of stuck scheduled flags should make this unnecessary.

alex_b’s picture

Fix: only reserves job when using the queue.

alex_b’s picture

- Fix some typos
- Move exception that gets thrown when no scheduler info can be found to dispatch() - allows for scheduling items that don't have an info callback declared /yet/

alex_b’s picture

Fixed further typos. This is very close now. Will need an update to Feeds.

alex_b’s picture

Status: Patch (to be ported) » Needs review
15.53 KB

This is tested now, will commit soon together with an according commit to Feeds.

Compatibility patch http://github.com/lxbarth/Feeds/commit/ff48db14abc57cc5801d92001263f7365...

alex_b’s picture

Status: Needs review » Patch (to be ported)

This is committed now. Needs to be ported to Drupal 6.

alex_b’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev
Status: Needs review » Patch (to be ported)
kyle_mathews’s picture

Has there been any progress on porting this patch to Drupal 6? I have a module I'd like to write that will be based on job_scheduler. This module isn't a super high priority at the moment but I could start if this patch were in.

alex_b’s picture

#11: should be fairly easy to back port. I haven't started on it at all though.

apramakr’s picture

Hi there!

Is there available an updated version of this module (along with this patch) for Drupal 6? I need this module in order to proceed with the Feeds module.
I would appreciate if this can be backported to Drupal 6 and comitted soon..

Thanks so much!

tourtools’s picture

waiting for the backported patch me too. Good work.

Jim Kirkpatrick’s picture

+1 for D6 version...

SepehrLajevardi’s picture


miurahr’s picture

I'd try to made ubuntu/debian package for job scheduler/ctools/feeds modules for D6.

tyler-durden’s picture

Is this why I cannot get Drupal Queue to work with Drupal 6 and Feeds Beta 9?

virtuali1151’s picture

Has this been back ported to 6 yet by chance?

brycesenz’s picture


notasheep’s picture


jmwhitco’s picture


Robin Millette’s picture

Guys, no need to subscribe anymore. Follow instead. Thanks!

twistor’s picture

Status: Patch (to be ported) » Closed (won't fix)

I'm going to go ahead and say this is not backport worthy anymore.

If someone wants to post a patch, I'd be happy to review it.

mikran’s picture

Category: bug » task
Status: Closed (won't fix) » Needs work

#24, in that case the bolded warning on project page should be removed / updated to reflect this.

intrafusion’s picture

Issue summary: View changes
Status: Needs work » Closed (outdated)