Skip to content
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

Create a savepoint for each step and rollback to it when Sage is wrapped in Ecto transaction #31

Open
AndrewDryga opened this issue Jun 28, 2018 · 0 comments

Comments

@AndrewDryga
Copy link
Member

There is a logical flaw in current Sage version, imagine that we have a transaction that inserts something in the database and no compensation for it (because the effect would be rolled back on transaction abort). If there is a retry on one of preceding steps to it - we may insert multiple records and succeed.

Fortunately, it's pretty easy to implement. We need to support transaction execution adapter which works similarly to inspection adapter and is called each time we want to apply or compensate a step. The adapter needs to take care of wrapping the sage and executing it. Additionally, it should allow executing code after it's committed (for #23).

In future, we would need something like sage_ecto package (which can be built in with if Code.ensure_loaded?(Ecto) for now).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant