diff --git a/internal/storage/dial.go b/internal/storage/dial.go index 274a06a2c..16cd75c98 100644 --- a/internal/storage/dial.go +++ b/internal/storage/dial.go @@ -145,7 +145,13 @@ func (c *Connection) Transaction(fn func(*Connection) error) error { return err } }); terr != nil { - return terr + // there exists a race condition when the context deadline is exceeded + // and whether the transaction has been committed or not + // e.g. if the context deadline has exceeded but the transaction has already been committed, + // it won't be possible to perform a rollback on the transaction since the transaction has been closed + if !errors.Is(terr, sql.ErrTxDone) { + return terr + } } return returnErr }