2
0

All Write errors are fatal

With TLS connections a Write timeout caused by a SetDeadline permanently
breaks the connection. However, the errors are reported as temporary. So
there is no way to determine if it really is recoverable. As these were
the only kind of Write error that was recovered all Write errors are now
fatal to the connection.

https://github.com/jackc/pgx/issues/494
https://github.com/jackc/pgx/issues/506
https://github.com/golang/go/issues/29971
This commit is contained in:
Jack Christensen
2019-01-28 22:45:44 -06:00
parent 4d2c112042
commit 6067cfab4f
3 changed files with 10 additions and 27 deletions
+2 -4
View File
@@ -133,11 +133,9 @@ func (b *Batch) Send(ctx context.Context, txOptions *TxOptions) error {
b.conn.pendingReadyForQueryCount++
}
n, err := b.conn.conn.Write(buf)
_, err = b.conn.conn.Write(buf)
if err != nil {
if fatalWriteErr(n, err) {
b.conn.die(err)
}
b.conn.die(err)
return err
}