2
0

Merge branch 'master' into composite

This commit is contained in:
David
2019-09-09 11:26:13 -07:00
parent 2d89e52d6f
commit fed099f04a
19 changed files with 951 additions and 70 deletions
+24 -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
}
@@ -268,6 +268,23 @@ func (b *Batch) Close() (err error) {
}
}
for b.conn.pendingReadyForQueryCount > 0 {
msg, err := b.conn.rxMsg()
if err != nil {
return err
}
switch msg := msg.(type) {
case *pgproto3.ErrorResponse:
return b.conn.rxErrorResponse(msg)
default:
err = b.conn.processContextFreeMsg(msg)
if err != nil {
return err
}
}
}
if err = b.conn.ensureConnectionReadyForQuery(); err != nil {
return err
}
@@ -281,10 +298,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)
}
}
}