mirror of
https://github.com/jackc/pgx.git
synced 2025-05-31 11:42:24 +00:00
Only set c.fakeNonblockingReadWaitDuration when it will be decreased
This commit is contained in:
parent
cf78472ce5
commit
f46d35610e
@ -432,10 +432,10 @@ func (c *NetConn) fakeNonblockingRead(b []byte) (n int, err error) {
|
|||||||
// a Read deadline will not block a read before it has a chance to read data already in Go or the OS's receive
|
// a Read deadline will not block a read before it has a chance to read data already in Go or the OS's receive
|
||||||
// buffer.
|
// buffer.
|
||||||
proposedWait := endTime.Sub(startTime) * 2
|
proposedWait := endTime.Sub(startTime) * 2
|
||||||
|
if proposedWait < minNonblockingReadWaitDuration {
|
||||||
|
proposedWait = minNonblockingReadWaitDuration
|
||||||
|
}
|
||||||
if proposedWait < c.fakeNonblockingReadWaitDuration {
|
if proposedWait < c.fakeNonblockingReadWaitDuration {
|
||||||
if proposedWait < minNonblockingReadWaitDuration {
|
|
||||||
proposedWait = minNonblockingReadWaitDuration
|
|
||||||
}
|
|
||||||
c.fakeNonblockingReadWaitDuration = proposedWait
|
c.fakeNonblockingReadWaitDuration = proposedWait
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user