Resiliency
Wayfinder includes built-in resiliency features:
- Gateway retry: If a gateway returns a 5xx error or a network failure occurs, Wayfinder automatically re-selects a different gateway and retries (up to 3 attempts). Client errors (4xx) are returned immediately without retry.
- Fetch timeouts: All outbound requests include configurable timeouts — 10s for metadata (HEAD, peer list), 30s for data retrieval — to prevent indefinite hangs on slow or dead gateways.
- Gateway health checks:
PingRoutingStrategyverifies the selected gateway responds before routing to it, and retries with a different one if not. - Peer list retries:
TrustedPeersGatewaysProviderretries when a gateway returns an empty peer list, then fails loudly rather than silently yielding no gateways — and the default provider falls back to the trusted gateway so that failure degrades routing instead of stopping it. - Registry pagination failures are fatal:
NetworkGatewaysProviderretries a failed page and throws once retries are exhausted, rather than returning a partial registry. Becauselimitis applied after sorting, a partial read would return the wrong gateways rather than merely fewer. - Full-registry pagination:
NetworkGatewaysProviderreads the whole on-chain registry before applyinglimit, solimitselects the top-ranked gateways rather than whichever ones happened to come back first. It pages at the SDK maximum, so this is a single request for a registry of the current size.
How is this guide?