From the get go, it was clear that the job scheduler in Feeds could be generalized and broken out of the module. The issues

#867910: Override schedule period
#721428: Make scheduler next scheduled time based

Have highlighted some of the conceptual problems in the current native scheduler that badly need cleanup:

- Very complex relationship between FeedsImporter, FeedsSource and FeedsScheduler.
- No way of 'slowing' or 'pausing' a single source.
- No way of rebuilding the schedule from scratch.

I've been working on cleaning up the internal scheduler API and wound up with a separate module "Job Scheduler", ready to be released independently of Feeds, Feeds would be relying on it.

It solves or the aforementioned problems or prepares the ground for their solution and vastly simplifies scheduling tasks.

Patch coming.

Comments

alex_b’s picture

Status: Active » Needs review
StatusFileSize
new47.9 KB

All tests passing.
Todo: test Drupal Queue integration.

This patch makes Feeds depend on:

http://drupal.org/project/job_scheduler

Note: includes/FeedsScheduler.inc is obsolete with this patch, the patch however does not remove it.

alex_b’s picture

StatusFileSize
new47.93 KB

Adjust to latest commit in job scheduler. Test working again.

alex_b’s picture

StatusFileSize
new56.52 KB

Fix upgrade path. Turns out that blindly executing module_enable() or drupal_install_modules() on a module that may not be available can set the system table's status bit to one while the module is actually not installed. A subsequent installation would fail as the module's schema does not get installed.

Here is the fix. It checks whether a module is actually available in Drupal's search path and only then installs it.

  $modules = module_rebuild_cache();
  if (isset($modules['job_scheduler'])) {
    if (!$modules['job_scheduler']->status) {
      drupal_install_modules(array('job_scheduler'));
      drupal_set_message(t('Installed Job Scheduler module.'));
    }
  }
  else {
    drupal_set_message(t('NOTE: Please install new dependency of Feeds: !job_scheduler module.', array('!job_scheduler' => l(t('Job Scheduler'), 'http://drupal.org/project/job_scheduler'))), 'warning');
  }
alex_b’s picture

Status: Needs review » Fixed

This is committed now.

Note that Feeds now depends on Job Scheduler.

http://drupal.org/cvs?commit=422432

andrewlevine’s picture

Great job on putting together this release. I tested the upgrade in the two scenarios you wanted me to and they seemed pretty well thought out and straight forward. I filed a couple bugs for the small issues I did come across.

I am a little bit worried about the changes with Job scheduler breaking my application just because so much code was shifted around and I have so much code waiting to be slightly broken. I imagine those will be bugs I just have to catch one by one.

Thanks for all your work on Feeds.

alex_b’s picture

I am a little bit worried about the changes with Job scheduler breaking my application just because so much code was shifted around

Don't hesitate to hit me up on IRC.

Thanks so much for this review!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.