mirror of https://github.com/jackc/pgx.git
BufferReadUntilBlock should release buf when no bytes read
This was causing allocations every time there was a non-blocking read with nothing to read. https://github.com/jackc/pgx/issues/1481pull/1490/head
parent
f839d501a7
commit
7941518809
|
@ -317,6 +317,8 @@ func (c *NetConn) BufferReadUntilBlock() error {
|
|||
if n > 0 {
|
||||
buf = buf[:n]
|
||||
c.readQueue.pushBack(buf)
|
||||
} else if n == 0 {
|
||||
iobufpool.Put(buf)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue