Skip to content

Commit 32b5484

Browse files
committed
cleanup
1 parent 44a57bf commit 32b5484

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

dbos/system_database.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2552,6 +2552,11 @@ func isRetryablePGError(err error) bool {
25522552
return false
25532553
}
25542554

2555+
// Special case for tx is closed, which can happen when rollbacking an already committed transaction, and vice versa.
2556+
if strings.Contains(err.Error(), "tx is closed") {
2557+
return false
2558+
}
2559+
25552560
// PostgreSQL codes indicating connection/admin shutdown etc.
25562561
var pgerr *pgconn.PgError
25572562
if errors.As(err, &pgerr) {
@@ -2680,7 +2685,7 @@ func retry(ctx context.Context, fn func() error, options ...retryOption) error {
26802685
lastErr = fn()
26812686

26822687
// Success and rollback case
2683-
if lastErr == nil || strings.Contains(lastErr.Error(), "tx is closed") {
2688+
if lastErr == nil {
26842689
return nil
26852690
}
26862691

0 commit comments

Comments
 (0)