If there are multiple feeds importers that are scheduled for import on a regular basis (using job scheduler and cron), sometimes all nodes will be updated, even though those nodes have not changed on the actual feed. The issue seems to be related to the following code:

protected function hash($item) {
    static $serialized_mappings;
    if (!$serialized_mappings) {
      $serialized_mappings = serialize($this->config['mappings']);
    }
    return hash('md5', serialize($item) . $serialized_mappings);
  }

It looks like the static variable $serialized_mappings is getting set for one feed but is not getting reset for subsequent feeds. For example, feed A starts importing, and $serialized_mappings is set to the mappings for that feed. Feed B starts next, and $serialized_mappings is already set to the mappings for feed A. So if B ever runs before A, the hash stored for the feed items will not match, and Feeds will believe they have changed, when indeed they haven't.

I am not quite sure how to best solve the issue, so for now, I am submitting a patch that will disable the use of the static variable allowing the hash to be generated correctly for each feed item.

CommentFileSizeAuthor
feeds-update-only-changed.patch621 bytesbyrond
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

olli’s picture

Status: Needs review » Closed (duplicate)