Core event dispatcher refactor and bug fixes
This PR reworks the core event dispatcher to:
- Bug fix: Due to internal implementation details of the databases used for event storage, the Booster event store receives a page of events that can potentially contain events belonging to different entities. If for some reason an exception is triggered in an entity reducer or a read model projection before all events in the page are visited, it could potentially halt the process and leave some events unattended. This change groups events by entity and processes each in a separate thread to gracefully manage errors in an entity without affecting others.
- Refactored the event store implementation: We had two different functions processing the events, one was used for the main event dispatcher, and the other was used by the
Booster.eventsfunction that fetches the current state of an entity. Now both methods use the same code. - Optimization: As part of the deduplication, the
fetchEntitySnapshotmethod now caches the generated snapshots by default to avoid reprocessing when the same entity is addressed often.
One thing that's missing related to this change is marking a Read Model as "not-updated", presumably in the errors array of GraphQL
Hey @NickSeagull, have you been able to make any progress on this PR?
Not really, will pick it up asap @jesusAlvSoto
Oops, looks like you forgot to add a changeset.
⚠️ Please run rush change and commit the changeset file.
This command will prompt you for a change description and generate a changeset file. You can read more about changesets here.
Remember that you should use the version bump that is appropriate for the change you are making:
| Version bump | Meaning |
|---|---|
patch |
Bug fixes, documentation changes, etc. |
minor |
New features, non-breaking changes |
major |
Breaking changes |
If you are unsure about which version bump to use, please ask in the comments and we will help you out.
/integration sha=1ef9fc7bc8005f35391612ce451d2a64adc98217
:white_check_mark: Integration tests have finished successfully!
/integration sha=8bf16dc41eb516b839fa88429ed5fd5c15c0c737
:x: Oh no! Integration tests have failed
:x: Oh no! Integration tests have failed
:x: Oh no! Integration tests have failed
/integration sha=225d95d4dc911e0ef2fcc652b1534f59ceccafae
:x: Oh no! Integration tests have failed
/integration sha=6fadbaf
:x: Oh no! Integration tests have failed
/integration sha=1e584ed672cbc768b6289b1c1b4fdabc32a55e70
:x: Oh no! Integration tests have failed
/integration sha=b4a398ba840068c67a4b8ddba1469bd2938cf71a
:white_check_mark: Integration tests have finished successfully!