Problem/Motivation

It looks like feeds_cron will first try to process un-queued items with next timestamp and then it will try to reset the queued timestamp for stuck items (which are queued more than 12 hours ago), but it will also select all un-queued items with queued = 0 and then it will save each feeds item individually which in my case leads to very long processing time (I have hook_entity_update for feeds).

Steps to reproduce

Run feeds_cron

Proposed resolution

Need to narrow down the list of feeds items which should be updated - exclude feeds items with queued = 0

replace this:

// Delete queued timestamp after 12 hours assuming the update has failed.
$ids = \Drupal::entityQuery('feeds_feed')
  ->condition('queued', \Drupal::time()->getRequestTime() - (3600 * 12), '<')
  ->execute();

to this:

// Delete queued timestamp after 12 hours assuming the update has failed.
$ids = \Drupal::entityQuery('feeds_feed')
  ->condition('queued', \Drupal::time()->getRequestTime() - (3600 * 12), '<')
  ->condition('queued', 0, '<>')
  ->execute();
CommentFileSizeAuthor
#2 3255000.patch463 bytesershov.andrey

Comments

ershov.andrey created an issue. See original summary.

ershov.andrey’s picture

StatusFileSize
new463 bytes
megachriz’s picture

Status: Active » Needs review

That the second query does select unqueued items does indeed look wrong. Let's see what the testbot says.

I'm also wondering for some time if this query causes problems if cron runs only once a day - especially when you use it in combination with deleting/unpublishing previous imported items.

megachriz’s picture

Status: Needs review » Fixed

Committed #2.

Status: Fixed » Closed (fixed)

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