feat(providers): add configurable request timeouts to RPC providers - #437
Merged
Lakes41 merged 1 commit intoJul 29, 2026
Merged
Conversation
- provider.types.ts: added WebSocketProviderConfig, SubscribableContractProvider, TransferEvent, TransferCallback types with requestTimeoutMs option - webSocketProvider.ts: replaced hardcoded 30s timeout with configurable requestTimeoutMs (default 10s), stored from constructor config - healthTracker.ts: added recordTimeout() tracking timeout-specific failures independently from other transient failures for adaptive provider scoring - adaptive.types.ts: added timeoutCount to UrlHealth for timeout frequency tracking - jsonRpcProvider.ts: already passes timeoutMs through to HttpClient via RequestOptions — no changes needed (existing default 10s in SDK config) Closes Adamantine-guild#424
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.
Closes #424
What
Added configurable per-request timeouts to both RPC providers, with timeout tracking surfaced through the health tracker for adaptive provider scoring.
Changes
provider.types.ts
WebSocketProviderConfigwithrequestTimeoutMsoption (default 10s)SubscribableContractProvider,TransferEvent,TransferCallbacktypeswebSocketProvider.ts
requestTimeoutMsfrom constructor configdefaultTimeoutMs)TIMEOUT(existing error code)healthTracker.ts
recordTimeout()— tracks timeout failures separately from other transient failurestimeoutCount()— exposes per-URL timeout count for adaptive provider scoringrecordFailurefor circuit-breaker logicadaptive.types.ts
timeoutCountas optional field onUrlHealthWhat already existed (no changes needed)
timeoutMsin RequestOptionsdefaultTimeoutMsin SDK config (10s)GuildPassTimeoutErrortests/per-request-timeout.test.tsBuild & Tests