mirror of
https://github.com/jackc/pgx.git
synced 2025-05-31 11:42:24 +00:00
Update pgxpool for latest pgconn
This commit is contained in:
parent
8170eaf401
commit
ddd9cf451e
@ -27,7 +27,7 @@ func (c *Conn) Release() {
|
|||||||
c.res = nil
|
c.res = nil
|
||||||
|
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
if conn.IsClosed() || conn.PgConn().TxStatus != 'I' || (now.Sub(res.CreationTime()) > c.p.maxConnLifetime) {
|
if conn.IsClosed() || conn.PgConn().TxStatus() != 'I' || (now.Sub(res.CreationTime()) > c.p.maxConnLifetime) {
|
||||||
res.Destroy()
|
res.Destroy()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -360,17 +360,17 @@ func TestConnReleaseClosesConnInFailedTransaction(t *testing.T) {
|
|||||||
|
|
||||||
pid := c.Conn().PgConn().PID()
|
pid := c.Conn().PgConn().PID()
|
||||||
|
|
||||||
assert.Equal(t, byte('I'), c.Conn().PgConn().TxStatus)
|
assert.Equal(t, byte('I'), c.Conn().PgConn().TxStatus())
|
||||||
|
|
||||||
_, err = c.Exec(ctx, "begin")
|
_, err = c.Exec(ctx, "begin")
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
assert.Equal(t, byte('T'), c.Conn().PgConn().TxStatus)
|
assert.Equal(t, byte('T'), c.Conn().PgConn().TxStatus())
|
||||||
|
|
||||||
_, err = c.Exec(ctx, "selct")
|
_, err = c.Exec(ctx, "selct")
|
||||||
assert.Error(t, err)
|
assert.Error(t, err)
|
||||||
|
|
||||||
assert.Equal(t, byte('E'), c.Conn().PgConn().TxStatus)
|
assert.Equal(t, byte('E'), c.Conn().PgConn().TxStatus())
|
||||||
|
|
||||||
c.Release()
|
c.Release()
|
||||||
waitForReleaseToComplete()
|
waitForReleaseToComplete()
|
||||||
@ -379,7 +379,7 @@ func TestConnReleaseClosesConnInFailedTransaction(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
assert.NotEqual(t, pid, c.Conn().PgConn().PID())
|
assert.NotEqual(t, pid, c.Conn().PgConn().PID())
|
||||||
assert.Equal(t, byte('I'), c.Conn().PgConn().TxStatus)
|
assert.Equal(t, byte('I'), c.Conn().PgConn().TxStatus())
|
||||||
|
|
||||||
c.Release()
|
c.Release()
|
||||||
}
|
}
|
||||||
@ -398,12 +398,12 @@ func TestConnReleaseClosesConnInTransaction(t *testing.T) {
|
|||||||
|
|
||||||
pid := c.Conn().PgConn().PID()
|
pid := c.Conn().PgConn().PID()
|
||||||
|
|
||||||
assert.Equal(t, byte('I'), c.Conn().PgConn().TxStatus)
|
assert.Equal(t, byte('I'), c.Conn().PgConn().TxStatus())
|
||||||
|
|
||||||
_, err = c.Exec(ctx, "begin")
|
_, err = c.Exec(ctx, "begin")
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
assert.Equal(t, byte('T'), c.Conn().PgConn().TxStatus)
|
assert.Equal(t, byte('T'), c.Conn().PgConn().TxStatus())
|
||||||
|
|
||||||
c.Release()
|
c.Release()
|
||||||
waitForReleaseToComplete()
|
waitForReleaseToComplete()
|
||||||
@ -412,7 +412,7 @@ func TestConnReleaseClosesConnInTransaction(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
assert.NotEqual(t, pid, c.Conn().PgConn().PID())
|
assert.NotEqual(t, pid, c.Conn().PgConn().PID())
|
||||||
assert.Equal(t, byte('I'), c.Conn().PgConn().TxStatus)
|
assert.Equal(t, byte('I'), c.Conn().PgConn().TxStatus())
|
||||||
|
|
||||||
c.Release()
|
c.Release()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user