How to reproduce:

  • Set up importer with multi-step fetcher (like Feeds Crawler). For example, set up fetching of 5 pages.
  • Enable periodic import.
  • Run import (scheduled import will be activated at this point)

Expected behavior:

  • Module imports as much pages as it can before the queue execution time runs out (15 seconds by default) on each cron run.

Actual behavior:

  • Module imports only one page on each cron run.

When import is still in progress FeedsSource::scheduleImport() will just re-schedule job using Job Scheduler module and zero period. But execution order is following:

  • drupal_cron_run()
    • job_scheduler_cron()
      • JobScheduler::get(...)->dispatch() - scheduled jobs are added to the Drupal cron queue
    • Drupal queue processing loop
      • feeds_source_import
        • FeedsSource::import()
        • FeedsSource::scheduleImport()

So, job scheduled in FeedsSource::scheduleImport() can't be processed on the same cron run, because Drupal queue don't know anything about it yet. This job will be added to the queue by JobScheduler on the next cron run only.

Comments

dmitriy.trt’s picture

Category: feature » bug
megachriz’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

I think this is no longer an issue since a fix for #1231332: periodic import imports only one file per cron was committed. That change made sure multiple import cycles could ran per cron run.