Skip to content

Commit 3fdbe5f

Browse files
Robin Biallyclaude
andcommitted
feat(replay): default to skipping recorded delays on replay
BUFFR_REPLAY_NODELAY now defaults to on, so replays emit chunks/frames back-to-back instead of re-spending the original generation time. Set BUFFR_REPLAY_NODELAY=0 to restore the recorded streaming cadence when the timing itself is under test. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 542fb4d commit 3fdbe5f

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

‎README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,9 @@ All flags have environment variable equivalents; flags take precedence.
173173

174174
<br />
175175

176-
buffr records the wall-clock delay before each SSE chunk / WebSocket frame and reproduces that cadence on replay — faithful, but it re-spends the original generation time (often seconds per call) on every run.
176+
buffr records the wall-clock delay before each SSE chunk / WebSocket frame. By default these delays are dropped on replay so chunks/frames are emitted back-to-back — payloads are identical, only the inter-chunk timing is gone. This keeps replays fast instead of re-spending the original generation time (often seconds per call) on every run.
177177

178-
Set `BUFFR_REPLAY_NODELAY=1` to emit all chunks/frames back-to-back. Payloads are identical; only the inter-chunk timing is dropped. Leave it unset when the streaming cadence itself is under test.
178+
Set `BUFFR_REPLAY_NODELAY=0` to reproduce the recorded cadence faithfully — do this when the streaming timing itself is under test.
179179

180180
</details>
181181

‎internal/proxy/http.go‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,13 @@ func matchHost(r *http.Request) string {
4242
return ""
4343
}
4444

45-
// ReplayNoDelay, when BUFFR_REPLAY_NODELAY=1, skips the recorded inter-chunk /
46-
// inter-frame delays on replay. Tests don't need the original streaming cadence,
47-
// and replaying it (per-chunk time.Sleep) dominates e2e runtime. Exported so it
48-
// can be toggled in tests; defaults from the env at startup.
49-
var ReplayNoDelay = os.Getenv("BUFFR_REPLAY_NODELAY") == "1"
45+
// ReplayNoDelay skips the recorded inter-chunk / inter-frame delays on replay.
46+
// Tests usually don't need the original streaming cadence, and replaying it
47+
// (per-chunk time.Sleep) dominates e2e runtime, so this defaults to on. Set
48+
// BUFFR_REPLAY_NODELAY=0 to restore the recorded cadence (e.g. when the
49+
// streaming timing itself is under test). Exported so it can be toggled in
50+
// tests; defaults from the env at startup.
51+
var ReplayNoDelay = os.Getenv("BUFFR_REPLAY_NODELAY") != "0"
5052

5153
// EgressTransport is the RoundTripper used for upstream HTTP requests in
5254
// record/auto mode. It defaults to http.DefaultTransport (system-root TLS

0 commit comments

Comments
 (0)