Problem/Motivation
See DestructableInterface and example implementations.
I would suggest we change to always creating message entities then and then we also eliminate the intermediate event message object and pass the entity to the Job and related classes.
If anything goes wrong with the almost-immediate processing then cron can still pick it up.
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork ww_publish-3211093
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
johnchqueComment #4
johnchqueComment #5
berdirI've been pondering about this for a while but I pushed a pretty big refactoring now. Event message entities are now always created, and the Job class is now a service which also includes protection against any sort of race condition both from external requests and also mixing the destruct method and running cron in case that overlaps.
This allows to retry a message import if something failed as well as being able to debug and see the received messages when not using the cron-only mode. And we no longer need an intermediate plain message object.
Also updated the settings form label and description to explain the new behavior.
Always having a message also opens up options to improve logging and for example log more information on a field on the message entity instead of watchdog or the nodes.
Comment #7
berdirCommitting, will run some more test in our project with this.