Skip to content

refactor: create timeout errors lazily in raceWithTimeout - #3712

Merged
Lightning00Blade merged 1 commit into
mainfrom
refactor/race-with-timeout-lazy-error
Dec 3, 2026
Merged

Lightning00Blade merged 1 commit into
mainfrom
refactor/race-with-timeout-lazy-error

Conversation

@Lightning00Blade

Copy link
Copy Markdown
Collaborator

Follow-up nits from #3611:

  • Change raceWithTimeout to accept createError: () => Error instead of an eagerly constructed error: Error, so the timeout error is only allocated when the deadline actually fires.
  • Update McpContext and ToolHandler callers to pass createError, and remove the redundant comment above raceExtensionOperation.
  • Update tests/utils/raceWithTimeout.test.ts to assert createError is only called when the deadline wins, and align the test description in tests/McpContext.test.ts.

No user-visible behavior changes.

@Lightning00Blade
Lightning00Blade added this pull request to the merge queue Dec 3, 2026
Merged via the queue into main with commit ad794fa Dec 3, 2026
17 checks passed
@Lightning00Blade
Lightning00Blade deleted the refactor/race-with-timeout-lazy-error branch December 3, 2026 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants