Repository navigation
Add a per-route request deadline for long streams - #10
Merged
Merged
Conversation
renerocksai
force-pushed
the
feat/per-route-deadline
branch
from
September 25, 2026 16:54
fc78e36 to
63f9f18
Compare
`RouteOptions.timeout_ms` gives one route its own deadline in place of `server.timeout_ms`. Registration requires `server.max_timeout_ms` to cover the value and rejects it otherwise with `error.InvalidRouteTimeout`. Baz asks the engine for the deadline before route middleware and continuation start. The continuations example adds `/long-stream`, which outlives the 3-second server deadline. Its integration case checks both execution modes and the following keep-alive request. Pins bounded/http PR #7 (`96c249b`), which adds `Config.max_timeout_ms` and `Context.setRequestTimeout`. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
bounded/http PR #7 now starts a request deadline at the request's first byte and bounds idle keep-alive time with `idle_timeout_ms`. Idle time no longer shortens a following request or stream. LIMITS.md and SSE.md describe the new start point and the idle bound. The continuations suite adds a stream that follows 2.5 idle seconds on a kept-alive connection with a 3-second default. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A request deadline now starts at the request's first byte, so pooled tailscale serve connections no longer shorten streams. The guide keeps the earlier measurements as history and points to RouteOptions.timeout_ms. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
renerocksai
force-pushed
the
feat/per-route-deadline
branch
from
September 25, 2026 17:04
63f9f18 to
695410b
Compare
bounded-http PR #7 is merged; pin its merge commit 874a8f3 on main instead of the branch head dae8961. The package hash is unchanged: the merged tree is the one verified on the branch. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends on bounded/http PR #7.
This branch pins that engine PR's head
dae8961, as Baz PR #6 did for engine PR #5.After engine #7 merges, move the pin to the engine's merged
maincommit (URL, commit and package hash together inbuild.zig.zon, plusdocs/DEPENDENCY.md).Rebased onto
mainafter #11.Problem
server.timeout_msbounds every request, including SSE streams.A stream needs minutes, but raising the global value lets any stalled request hold a connection that long.
The omajot hub (a Baz app behind
tailscale serve) hit this with its SSE doorbell.API
RouteOptions.timeout_ms: ?u32 = nullworks forrouteWith,routeContinuation,bindWithandendpointWith.error.InvalidRouteTimeoutfor zero, or for a value aboveserver.max_timeout_ms(default 0, disabled).Idle keep-alive time (found with #11)
tailscale servereuses idle backend connections. Before, the idle time counted toward the next request's deadline, so streams ended early.Engine #7 now starts a request deadline at its first byte, and the new
server.idle_timeout_msbounds idle time separately (0 =timeout_ms).docs/HTTPS.mdreplaces its "Current limit" paragraph with the fixed behavior.LIMITS.mdandSSE.mddescribe the new start point.continuations_integration.pyadds a stream after 2.5 s idle on a kept-alive connection with a 3 s default, in both modes.Changes
src/App.zig: option, validation, application, and a registration unit test.examples/continuations.zig:/long-stream(two 2-second pauses, 10-second route timeout, 3-second server default).tests/continuations_integration.py: the long stream completes after more than 3.5 s and the connection stays usable, in inline and worker execution.LIMITS.mdrow, a newSSE.mdsection, notes inSTREAMING.mdandMIDDLEWARE.md, and the pin record inDEPENDENCY.md.Verification (Linux omarx1, exact Zig 0.16.0)
zig build verifyin Debug and ReleaseSafe: 70/70 steps, 245/245 tests each.zig build install examples -Doptimize=ReleaseSafe: ok.tools/build_pages.pyandtools/check_site.py: pass.macOS and Windows for Baz rely on hosted CI.
The engine PR records native macOS (kqueue) results for the engine change itself.
Follow-up (not in this PR)
When the deadline expires, the engine closes a chunked stream without the terminating
0\r\n\r\n.Browsers reconnect with
Last-Event-ID, butstd.http.ClientreportsReadFailed.A later engine change could end the stream cleanly at a chunk boundary.
🤖 Generated with Claude Code