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

If a migration fails on the first batch it doesn't save that failed state to the DB #5

Open
ianmacartney opened this issue Sep 27, 2024 · 0 comments

Comments

@ianmacartney
Copy link
Collaborator

When a migration fails on the first batch, it returns the failure but doesn't persist the failure to the database.

This can be confusing when it wasn't started directly by a user, as the failure isn't apparent when you ask for the status - it's either not there, or showing results from a previous run.

The tradeoff is that we could always persist the start of a migration but do no work in the first mutation, but then when you run it directly you won't see the immediate failure (because it will happen in a scheduled function).

I currently think it's more helpful to see the failure of the first batch, at the cost of not having a record of it.

Why not fail and persist?

We could catch the failure and then persist, but catching the failure doesn't roll back the failure's changes.

Potential workaround: we could use runMutation to run a sub-transaction that could fail and roll back, but the outer transaction can catch that and persist the failure, without accidentally committing the sub-transaction's changes. 💡

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