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();
Comments
Comment #2
ershov.andrey commentedComment #3
megachrizThat 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.
Comment #4
megachrizCommitted #2.