-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improves transaction rollback handling
I added a libpq transaction status check to the `BracketSuccess` branch of `withTransaction` that will ensure that the transaction has the `TransInTrans` state before issuing the success callback. If the status is `TransInError`, the transaction will be rolled back. If it is anything else, the transaction will be rolled back and an `UnexpectedTransactionStatusError` will be thrown. Additionally, I added exception handling around the success SQL execution that will run the rollback callback if executing the SQL fails with a `SqlExecutionError`, which could happen if a transaction cannot be committed due to something like a serialization error.
- Loading branch information
Showing
2 changed files
with
67 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters