-
Notifications
You must be signed in to change notification settings - Fork 83
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
Rollback on exception #18
Comments
Can we get more info on this? Is this exceptions chucked due to constraint violations? Exceptions due to shit code? |
It seems exceptions thrown before db.session.commit don't stop the changes being saved. This means (for gocardless_start) if payment.bill_url() fails, you've still bought the tickets, but didn't get redirected, so they end up in limbo. We probably need to add a top-level request exception handler that calls db.session.rollback. Alternatively, it might be sqlalchemy not using transactions correctly with sqlite (haven't tested with psql). |
This sounds like the db connection has autocommit set? |
Probably, I assumed that was Flask's responsibility. So the wrapper also needs to call begin. |
i can test this with psql if it would help? |
Heh, I was just about to do the same. Will leave it if you're confident :) |
done, what exactly is the test case? there is a db.session.commit() in buy_prepay_tickets so we are commiting before we generate the bill url... maybe move the commit to just before we return the redirect? |
Looks like this does not happen with postgres so we don't have to worry about it. Not closeing, but removing from the milestone. |
If this doesn't happen with postgres, why aren't we closing it? |
If the same test been run against sqlite, I'm happy to. Will do this tomorrow. |
SQLAlchemy seems to be committing regardless
The text was updated successfully, but these errors were encountered: