Commit 6fd5b61
Drain all buffered ACKs per I/O loop iteration
Previously, tryReceiveAcks() called tryReceiveFrame() exactly once
per I/O loop iteration. In the DRAINING state (all batches sent, ACKs
still pending), the I/O thread sleeps 10 ms after each call. This meant
each in-flight frame added ~10 ms to flush latency: N in-flight frames
incurred ~N x 10 ms overhead, even when all ACKs were already sitting in
the TCP receive buffer.
Fix by looping tryReceiveFrame() until it returns false, draining all
buffered ACKs in a single pass. The 10 ms sleep is now reached only when
no more data is available, which is the correct condition for avoiding a
busy loop.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 999464c commit 6fd5b61
1 file changed
Lines changed: 3 additions & 1 deletion
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
555 | 555 | | |
556 | 556 | | |
557 | 557 | | |
558 | | - | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
559 | 561 | | |
560 | 562 | | |
561 | 563 | | |
| |||
0 commit comments