-
Notifications
You must be signed in to change notification settings - Fork 0
Foreign Constraint Error/Race Condition on TeamUser Projection #27
Copy link
Copy link
Open
Description
Description
The user registration workflow triggers the UserRegistered process manager, which creates a user, creates a team and then adds the user to the team. All three have read model projections. The TeamUser projection may attempt to project a team user association before the Team and User projections have finished, which causes a foreign constraint error.
Steps to Reproduce
Run mix test for the following files which test the user registration workflow:
test/reply_express_web/controllers/api/v1/users/registration_controller_test.exstest/reply_express/accounts/users_context_test.exstest/reply_express/accounts/users_context_test.exs
Recommended Solution
See usage of the error/2 callback on the Elixir Commanded.Projections.Ecto package and Commanded.Event.Handler package. Introduce a retry after delay:
https://hexdocs.pm/commanded_ecto_projections/usage.html#error-handlinghttps://hexdocs.pm/commanded/Commanded.Event.Handler.html#c:error/3
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Projects
Status
Backlog