Repository navigation
fix(client): apply the timeout option to every request - #12
Merged
Merged
Conversation
ClientOptions.timeout was documented with a 60000 default but never read, so a stalled request waited for undici's own limit. Each bound operation now gets AbortSignal.timeout(timeout); a per-call signal replaces it, 0 or Infinity disables it, and the default is 300000 to cover synchronous publishNow creates. Mirrored in scripts/generate-client.ts.
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.
Why
ClientOptions.timeoutwas documented (default 60000) but never read, so a stalled request waited for undici's own limit (about 300s) and surfaced asfetch failed/terminated. It has been unwired since the initial commit.What
_bindnow gives each callsignal: AbortSignal.timeout(timeout). hey-api spreads call options into the oneRequest, so no custom fetch or interceptor is needed.signalreplaces the timeout for that call (noAbortSignal.any, engines allows Node 18.0).publishNowcreates publish inside the request and the API allows up to 300s.0orInfinitydisables it; other values are rounded up and capped soAbortSignal.timeoutnever throws.TimeoutErrorpropagates unwrapped.scripts/generate-client.ts, which generatessrc/client.ts.tests/timeout.test.tsruns against a real local server. Before the fix the first test fails withTest timed out in 5000ms.Follow-ups
x-request-id, but the client sends none. A retriedpublishNowafter a timeout can hit the duplicate check. Separate PR.[Unreleased]heading needs the version oncegenerate.ymlpublishes.