File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -1712,7 +1712,13 @@ func (pgConn *PgConn) makeCommandTag(buf []byte) CommandTag {
1712
1712
// enterPotentialWriteReadDeadlock must be called before a write that could deadlock if the server is simultaneously
1713
1713
// blocked writing to us.
1714
1714
func (pgConn * PgConn ) enterPotentialWriteReadDeadlock () {
1715
- pgConn .slowWriteTimer .Reset (10 * time .Millisecond )
1715
+ // The time to wait is somewhat arbitrary. A Write should only take as long as the syscall and memcpy to the OS
1716
+ // outbound network buffer unless the buffer is full (which potentially is a block). It needs to be long enough for
1717
+ // the normal case, but short enough not to kill performance if a block occurs.
1718
+ //
1719
+ // In addition, on Windows the default timer resolution is 15.6ms. So setting the timer to less than that is
1720
+ // ineffective.
1721
+ pgConn .slowWriteTimer .Reset (15 * time .Millisecond )
1716
1722
}
1717
1723
1718
1724
// exitPotentialWriteReadDeadlock must be called after a call to enterPotentialWriteReadDeadlock.
You can’t perform that action at this time.
0 commit comments