booster icon indicating copy to clipboard operation
booster copied to clipboard

Core event dispatcher refactor and bug fixes

Open NickSeagull opened this issue 3 years ago • 1 comments

This PR reworks the core event dispatcher to:

  1. 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.
  2. 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.events function that fetches the current state of an entity. Now both methods use the same code.
  3. Optimization: As part of the deduplication, the fetchEntitySnapshot method now caches the generated snapshots by default to avoid reprocessing when the same entity is addressed often.

NickSeagull avatar Jun 22 '22 14:06 NickSeagull

One thing that's missing related to this change is marking a Read Model as "not-updated", presumably in the errors array of GraphQL

NickSeagull avatar Jul 01 '22 17:07 NickSeagull

Hey @NickSeagull, have you been able to make any progress on this PR?

jesusAlvSoto avatar Jan 16 '23 11:01 jesusAlvSoto

Not really, will pick it up asap @jesusAlvSoto

NickSeagull avatar Jan 16 '23 12:01 NickSeagull

👇 Click on the image for a new way to code review

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map legend

ghost avatar Jan 20 '23 17:01 ghost

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.

github-actions[bot] avatar Jan 20 '23 17:01 github-actions[bot]

/integration sha=1ef9fc7bc8005f35391612ce451d2a64adc98217

javiertoledo avatar Jan 30 '23 17:01 javiertoledo

:hourglass: Integration tests are running...

Check their status here 👈

github-actions[bot] avatar Jan 30 '23 17:01 github-actions[bot]

:white_check_mark: Integration tests have finished successfully!

github-actions[bot] avatar Jan 30 '23 18:01 github-actions[bot]

/integration sha=8bf16dc41eb516b839fa88429ed5fd5c15c0c737

javiertoledo avatar Feb 22 '23 15:02 javiertoledo

:hourglass: Integration tests are running...

Check their status here 👈

github-actions[bot] avatar Feb 22 '23 15:02 github-actions[bot]

:x: Oh no! Integration tests have failed

github-actions[bot] avatar Feb 22 '23 16:02 github-actions[bot]

:x: Oh no! Integration tests have failed

github-actions[bot] avatar Feb 22 '23 18:02 github-actions[bot]

:x: Oh no! Integration tests have failed

github-actions[bot] avatar Feb 22 '23 19:02 github-actions[bot]

/integration sha=225d95d4dc911e0ef2fcc652b1534f59ceccafae

javiertoledo avatar Feb 23 '23 12:02 javiertoledo

:hourglass: Integration tests are running...

Check their status here 👈

github-actions[bot] avatar Feb 23 '23 12:02 github-actions[bot]

:x: Oh no! Integration tests have failed

github-actions[bot] avatar Feb 23 '23 13:02 github-actions[bot]

/integration sha=6fadbaf

javiertoledo avatar Feb 24 '23 16:02 javiertoledo

:hourglass: Integration tests are running...

Check their status here 👈

github-actions[bot] avatar Feb 24 '23 16:02 github-actions[bot]

:x: Oh no! Integration tests have failed

github-actions[bot] avatar Feb 24 '23 18:02 github-actions[bot]

/integration sha=1e584ed672cbc768b6289b1c1b4fdabc32a55e70

javiertoledo avatar Feb 27 '23 17:02 javiertoledo

:hourglass: Integration tests are running...

Check their status here 👈

github-actions[bot] avatar Feb 27 '23 17:02 github-actions[bot]

:x: Oh no! Integration tests have failed

github-actions[bot] avatar Feb 27 '23 18:02 github-actions[bot]

/integration sha=b4a398ba840068c67a4b8ddba1469bd2938cf71a

javiertoledo avatar Feb 27 '23 20:02 javiertoledo

:hourglass: Integration tests are running...

Check their status here 👈

github-actions[bot] avatar Feb 27 '23 20:02 github-actions[bot]

:white_check_mark: Integration tests have finished successfully!

github-actions[bot] avatar Feb 27 '23 21:02 github-actions[bot]