2
0

Terminate context prior to releasing when killing batch connection

This commit is contained in:
Andrew S. Brown
2019-08-04 15:31:32 -07:00
parent a1d6202434
commit 7fe7f33557
+7 -4
View File
@@ -135,7 +135,7 @@ func (b *Batch) Send(ctx context.Context, txOptions *TxOptions) error {
_, err = b.conn.conn.Write(buf)
if err != nil {
b.conn.die(err)
b.die(err)
return err
}
@@ -281,10 +281,13 @@ func (b *Batch) die(err error) {
}
b.err = err
b.conn.die(err)
if b.conn != nil {
err = b.conn.termContext(err)
b.conn.die(err)
if b.conn != nil && b.connPool != nil {
b.connPool.Release(b.conn)
if b.connPool != nil {
b.connPool.Release(b.conn)
}
}
}