Skip to content

Eventstream uncommittedEvents possibly overwrites events that were not committed yet #84

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
albe opened this issue Oct 19, 2016 · 1 comment

Comments

@albe
Copy link
Contributor

albe commented Oct 19, 2016

Scenario: Retrieve the evenstream of an aggregate and keep a reference to it, adding new events to it and committing occassionally.

Expected Result: All events added to the stream are actually persisted

Actual Result: Some events are not persisted, because the uncommittedEvents array has been altered between the store.addEvents() call and the callback (async IO) and then gets overwritten with an empty array [].

Solution: Create a copy of the eventstream.uncommittedEvents array and reset the uncommitedEvents early before the IO call, then use the copy inside the callback only and re-append the uncommitted events on error.

@albe
Copy link
Contributor Author

albe commented Oct 19, 2016

/cc @f3lang

@adrai adrai closed this as completed in #85 Oct 20, 2016
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant