Fix event subscriber table not updating busy status after initial events iteration #2295
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.
This PR proposes a fix for this issue: #2294.
The bug as defined in the above issue is summarized as: Creating a new application with a custom-read-model-connector results in the custom read model projection handler not being called. The event subscriber table keeps the current state of an event subscriber with the
busy
column. In the problematic case on app startup, an empty array of events are retrieved for the custom read model. This results in running code where thebusy
state is never updated to false. Since there is a check forbusy
before calling event handlers, the check always returnsbusy
is true and the event handling is exited early.The fix in this PR updates the event subscriber table and
busy
to false after an empty array of events is processed. Before this fix, execution ends in an empty if block with the commentTODO???
. It's also possible the real problem is the event handler processing functioncustom-read-model.ts
build
function should never be called.With this fix, custom read model projection handlers are called like normal.