2
0

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:
Jack Christensen
2020-07-13 22:48:28 -05:00
parent 2583134306
commit c8a9da960c
+2 -16
View File
@@ -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{}