2
0

Replace IsAlive with IsClosed

IsAlive is ambiguous because the connection may be dead and we do not
know it. It implies the possibility of a ping. IsClosed is clearer -- it
does not promise the connection is alive only that it hasn't been
closed.
This commit is contained in:
Jack Christensen
2019-08-24 23:49:59 -05:00
parent d5a6a5e7e0
commit a262126b5c
6 changed files with 19 additions and 25 deletions
+1 -1
View File
@@ -27,7 +27,7 @@ func (c *Conn) Release() {
c.res = nil
now := time.Now()
if !conn.IsAlive() || 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()
return
}