When the feeds import settings are:

Periodic import: Off

Import on submission: Off

Process in background: On

The cron does not call the process in background code. Used dd to trace through the code to a point and found it never hits the parser, how should this work?
I'm using a custom parser. Could that be the reason? Is there a specific way to implement it so that process in background works?
Setting the feed to use a periodic import results in the system working as expected.

Using the latest dev.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dineshw’s picture

Does that is the case with Periodic import: On

MegaChriz’s picture

Run into this issue today. Upon further investigation, it kinda make sense that the combination of these settings don't work. But it is in nowhere obvious.

Well, here is how it makes sense:

  • When "Import on submission" and "Process in background" both are checked, and you hit "Import", the import is scheduled to run in the background (instead of using the Batch API). One confusing thing though: it will run the first import cycle before scheduling it to run in the background. Even more confusing: if the parser doesn't support running the import in multiple chunks it will just run the whole import and never run in background.
  • When "Import on submission" is not checked, the "Process in background" setting only has effect when the importer is attached to a content type. Or when calling FeedsSource::startImport() via an other route.
  • When "Periodic import" and "Import on submission" are both turned off and the importer is not attached to a content type, then essentially nothing will be imported. In this case, hitting "Import" on a standalone form is being evaluated as "on submission" and the settings tell it should do nothing, thus also not schedule it for importing in background.

Confusing, huh?

MegaChriz’s picture

Category: Support request » Task
Status: Active » Needs review
FileSize
3.96 KB

This patch adds a nice warning to the user.

I also like to make the run in background thing to be really run in the background (not import the first bit and then continue in the background), but first I'd like to see if this breaks anything.

Status: Needs review » Needs work

The last submitted patch, 3: feeds-process-in-background-validation-2445477-3.patch, failed testing.

MegaChriz’s picture

Yep. Some test failures.

New patch.

MegaChriz’s picture

Title: Process in background not working with cron » Process in background not working with cron with certain combination of settings
FileSize
5.88 KB
2.41 KB

Reroll + some additional changes that are needed now that #2868134: Show next time that the source will be imported and #2630694: Run background jobs directly in queue. are committed.

MegaChriz’s picture

Title: Process in background not working with cron with certain combination of settings » Process in background not working with certain combination of settings
MegaChriz’s picture

This also adds a warning when the "Process in background" setting turned on has no effect. This setting has no effect when using the standalone form and the "Import on submission" setting turned off.

  • MegaChriz committed 544955b on 7.x-2.x
    Issue #2445477 by MegaChriz: Added validation for combination of...
MegaChriz’s picture

Status: Needs review » Fixed

Committed #8.

Status: Fixed » Closed (fixed)

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

totko123’s picture

Hello ,
I am using feeds version 7.x-2.x:-beta 3 , does this patch is aplicable for my version and how can I patch it?