MetaMask / MetaMask/core

[eth-json-rpc-middleware] [fetch] Support Retry-After response header

Open
#6,872 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
413
Forks
308
Avg merge
1d 4h
Merged PRs (30d)
253

Description

Update the retry logic to look for the `Retry-After` header, and respect the suggested wait time if one is provided.

We should also setting a max wait time, so that the request will fail rather than waiting an inordinate amount of time. A decent max setting might be between 30 seconds to 10 minutes - somewhere in that range. If we wait too long, it becomes increasingly likely that the user may have moved on from the page/operation/etc. that triggered the request (especially considering that we don't yet support cancellation; see MetaMask/core#6873)

For longer wait periods caused by rate limiting, returning an error explaining the delay would be preferable to the request hanging for an hour or longer. That way we can explain the delay to the user directly.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in the eth-json-rpc-middleware fetch retry logic and trace how response headers and retry delays are handled. Done means honoring a provided Retry-After value, enforcing a maximum wait, and returning an explanatory error when the delay exceeds that limit.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.