Issue #6534
closedHaving same content in one batch can cause issues in _post_save of ContentSaver
Description
ContentSaver lets the duplicated content from one batch to be processed in the _post_save. It can cause issues, I'm not sure if duplicates bring any benefit.
Imagine 2 same content units in one batch. According to the code here:
- first declarative content is fully processed
- second declarative content falls under IntegrityError, it now has the same content associated with it, and further processing of this stage is not happening BUT...
- ... the whole batch (2 declarative content units) is then getting processed by the _post_save
The purpose of the _post_save method (to my understanding) is to perform some additional actions, usually db operations, to make a piece of content complete or perform something essential after each content is saved.
Currently, in RPM plugin we run into the issue that those essential operations are performed twice for a content unit if there are 2 same content units in a batch. This is an undesirable behaviour.
It can be fixed in each plugin in a _post_save if they have it, or maybe it's worth fixing it in the stages in pulpcore.