-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrap paddle actions with DB transactions #2558
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good one! And I agree that moving to Ecto.Multi is a good idea and we should do it in a separate release.
BundleMonUnchanged files (7)
No change in files bundle size Final result: ✅ View report in BundleMon website ➡️ |
@vinibrsl made the errors bubble up so it rolls back this time |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Is there any benefit between Ecto.Multi
vs Repo.transaction
? If I understand right it's just cosmetic / style difference or is there more to it?
Repo.transaction accepts Ecto.Multi structs. The way I see it there's testability benefit - you can test some aspects without having to provision the DB; sometimes all you care about is whether the transaction structure/context has been built valid, not whether the database works. You also get better insight into failures, the failing step is explicitly named & returned. It makes it simpler to mock (or skip) certain transaction steps if need be. You can compose multiple Multis 😈 together with little to no effort - this supports building "service oriented" code bases. |
* Wrap paddle actions with DB transactions * Bow to credo * Make the paddle transactions crash when applicable * s/changeset/details
Changes
This change makes all the paddle webhook updates transactional.
I considered rewriting it to Ecto.Multi-based services but that can be made on top of this in another iteration, since shipping the change itself feels quite critical.
Tests
Changelog
Documentation
Dark mode