Improvement to the hash comparison in EntityProcessorBase to avoid duplicated revisions.

Created on 29 November 2023, about 1 year ago
Updated 22 February 2024, 10 months ago

Problem/Motivation

We created a customized work flow: With the help of a custom event subscriber, we set all new revisions to be in "draft" status.

This had a side effect: It creates new revisions every time the feed is executed.

Cause: The hash is saved to the new draft revision, but next time the feed is executed, it uses the hash from the "current revision", the published one, not the most recent revision created previously.

So it goes in a loop, the hash never matches and new revisions are created over and over.

Steps to reproduce

1. Create an event subscriber service for the FeedsEvents::PROCESS_ENTITY_PRESAVE event to set the moderation_state of new revisions to draft.
2. Import a feed.
3. Make sure the node that was created/updated is in draft status.
3. drush sqlq "UPDATE node_revision__feeds_item SET feeds_item_hash = 'random-nonsense' WHERE entity_id = NODE-ID-GOES-HERE"
4. Import the feed multiple times.

It will create new revisions over and over.

Proposed resolution

I know this is a problem created by our custom code, but perhaps this scenario could be covered in the module.

At least I am opening this issue and leaving the patch I created in case anyone runs into similar problems.

Feature request
Status

Active

Component

Code

Created by

🇧🇷Brazil adinancenci

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024