From fd54b10d976dffa184d978d37989eb5120b473f2 Mon Sep 17 00:00:00 2001 From: RPRX <63339210+RPRX@users.noreply.github.com> Date: Mon, 1 Sep 2025 09:47:17 +0000 Subject: [PATCH] TimeoutWrapperReader: Fix latency issue Pre-released for 2 days and no one had ever noticed this issue until today : ( --- common/buf/io.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/common/buf/io.go b/common/buf/io.go index 0b3cc6b2..e1de461d 100644 --- a/common/buf/io.go +++ b/common/buf/io.go @@ -54,12 +54,16 @@ func (r *TimeoutWrapperReader) ReadMultiBufferTimeout(duration time.Duration) (M close(r.done) }() } - time.Sleep(duration) + timeout := make(chan struct{}) + go func() { + time.Sleep(duration) + close(timeout) + }() select { case <-r.done: r.done = nil return r.mb, r.err - default: + case <-timeout: return nil, nil } }