Skip to content

Commit f40a25d

Browse files
committed
Fix idle timer not reset after successful GCS Read completion
The idle timer was started/reset before each Read call but never reset after successful completion. This meant the effective inter-Read idle budget was reduced by the read duration itself. If a single GCS Read took 9s, only 1s remained for the consumer before the timer fired. A slow consumer (UFFD back-pressure, decompressor buffering) could easily exceed that shrunken window, causing spurious context cancellation - exactly the scenario the per-Read idle timer was meant to protect against. Adding timer.Reset after successful reads gives the consumer the full idle budget after each completed read operation.
1 parent 1a7b59d commit f40a25d

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

packages/shared/pkg/storage/storage_google.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,8 @@ func (r *idleTimeoutReader) Read(p []byte) (int, error) {
303303
n, err := r.ReadCloser.Read(p)
304304
if err != nil {
305305
r.timer.Stop()
306+
} else {
307+
r.timer.Reset(r.idle)
306308
}
307309
return n, err
308310
}

0 commit comments

Comments
 (0)