fix: double delete events are handled correctly #341
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
stream-registry PR
DefaultEntityViewUpdater
to handle receiving double delete events correctly.Details
The delete logic is slightly convoluted. Whenever we receive a delete event, we look up the original entity (if it exists) and keep a record of it so that agents are able to reconcile deletes using the last state of the entity prior to being deleted.
In some cases in the future, it might be required to "double send" deletes. E.g. a Delete event is sent for an entity that has already been deleted. Before this change, any subsequent delete event would cause the reference to the last state of the entity to be lost. Now it doesn't.
It's worth noting that in normal operations, when an agent is handling events on demand, this doesn't cause too many problems since the first delete event will be reconciled while the last known state of the entity is still available. However, this can cause problems for agents that are running scheduled reconciliation processes.
Changed
Now handles receiving the same delete event multiple times correctly.
PR Checklist Forms