You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add RollbackWithoutCancel helper to have rollbacks supersede context cancellation (#1062)
Here, add a `dbutil.RollbackWithoutCancel` helper. The purpose of this
is in situations where an operation is in a transaction but ends up
cancelling due to a context timeout. From there, there tends to be a
rollback in a `defer`, but the rollback ends up not running because its
context is already cancelled.
The new helper removes a cancelled context, then adds a new 5 second
context timeout to run the rollback command. This is mainly used for
`JobSchedule` in the hopes of coming up with a fix for #1059, but we use
the new function everywhere that we previously had a manual rollback,
and it also gets add to the `dbutil.WithTx*` helpers so that it gets
used anywhere those do (and these should probably be preferred most of
the time because it makes rollbacks and commits harder to forget).
Fixes#1059.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
10
10
### Fixed
11
11
12
12
- Fix snoozed events emitted from `rivertest.Worker` when snooze duration is zero seconds. [PR #1057](https://github.com/riverqueue/river/pull/1057).
13
+
- Rollbacks now use an uncancelled context so as to not leave transactions in an ambiguous state if a transaction in them fails due to context cancellation. [PR #1062](https://github.com/riverqueue/river/pull/1062).
0 commit comments