Revert "stdlib: close connection on Tx commit or rollback that doesn't end Tx"
This reverts commit 2583134306.
This fix should actually be on the main Tx implementation.
This commit is contained in:
+2
-16
@@ -716,23 +716,9 @@ type wrapTx struct {
|
||||
tx pgx.Tx
|
||||
}
|
||||
|
||||
func (wtx wrapTx) Commit() error {
|
||||
pgxConn := wtx.tx.Conn()
|
||||
err := wtx.tx.Commit(wtx.ctx)
|
||||
if err != nil && pgxConn.PgConn().TxStatus() != 'I' {
|
||||
_ = pgxConn.Close(wtx.ctx) // already have error to return
|
||||
}
|
||||
return err
|
||||
}
|
||||
func (wtx wrapTx) Commit() error { return wtx.tx.Commit(wtx.ctx) }
|
||||
|
||||
func (wtx wrapTx) Rollback() error {
|
||||
pgxConn := wtx.tx.Conn()
|
||||
err := wtx.tx.Rollback(wtx.ctx)
|
||||
if err != nil && pgxConn.PgConn().TxStatus() != 'I' {
|
||||
_ = pgxConn.Close(wtx.ctx) // already have error to return
|
||||
}
|
||||
return err
|
||||
}
|
||||
func (wtx wrapTx) Rollback() error { return wtx.tx.Rollback(wtx.ctx) }
|
||||
|
||||
type fakeTx struct{}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user