fix: use timeout-bounded HTTP client for unary Read and Append#255
fix: use timeout-bounded HTTP client for unary Read and Append#255infiniteregrets merged 1 commit intomainfrom
Conversation
Unary Read and Append were using the streaming HTTP client (Timeout: 0) via getHTTPClient(), ignoring the configured RequestTimeout. Use basinClient.httpClient instead, consistent with CheckTail and other unary operations. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Greptile SummaryThis PR fixes unary Key changes:
Streaming sessions are unaffected: Confidence Score: 4/5Safe to merge for standard unary use; however, existing callers using The s2/read.go — the interaction between Important Files Changed
Sequence DiagramsequenceDiagram
participant Caller
participant StreamClient
participant httpClient (timeout-bounded)
participant streamingClient (no timeout)
participant S2 API
Note over httpClient (timeout-bounded): Timeout = RequestTimeout (default 5s)
Note over streamingClient (no timeout): Timeout = 0
Caller->>StreamClient: Append(ctx, input)
StreamClient->>httpClient (timeout-bounded): requestProto (POST /streams/{name}/records)
httpClient (timeout-bounded)->>S2 API: HTTP POST
S2 API-->>httpClient (timeout-bounded): AppendAck
httpClient (timeout-bounded)-->>StreamClient: AppendAck
StreamClient-->>Caller: *AppendAck
Caller->>StreamClient: Read(ctx, opts)
StreamClient->>httpClient (timeout-bounded): requestProto (GET /streams/{name}/records)
Note right of httpClient (timeout-bounded): If opts.Wait > RequestTimeout, client deadline fires first
httpClient (timeout-bounded)->>S2 API: HTTP GET
S2 API-->>httpClient (timeout-bounded): ReadBatch
httpClient (timeout-bounded)-->>StreamClient: ReadBatch
StreamClient-->>Caller: *ReadBatch
Caller->>StreamClient: AppendSession(ctx)
StreamClient->>streamingClient (no timeout): POST /streams/{name}/records (streaming)
streamingClient (no timeout)->>S2 API: HTTP/2 bidirectional stream
S2 API-->>streamingClient (no timeout): AppendAck (stream)
Caller->>StreamClient: ReadSession(ctx, opts)
StreamClient->>streamingClient (no timeout): GET /streams/{name}/records (streaming)
streamingClient (no timeout)->>S2 API: HTTP/2 SSE/S2S stream
S2 API-->>streamingClient (no timeout): ReadBatch (stream)
|
closes #234
Summary
ReadandAppendwere usinggetHTTPClient()which returns the streaming HTTP client (Timeout: 0), ignoring the configuredRequestTimeout.s.basinClient.httpClient(the timeout-bounded client), consistent withCheckTailand other unary operations.AppendSession,ReadSession) continue to use the no-timeout streaming client viagetHTTPClient().Test plan
go build ./...passesRead/Appendnow respectRequestTimeoutunder network delays🤖 Generated with Claude Code