MetaMask / MetaMask/core

[network-controller] Add `lookupNetwork` timeout

Open
#4,499 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement team-core-platform team-wallet-framework wf-network-controller-improvements
Dominant language
TypeScript
Stars
413
Forks
308
Avg merge
1d 4h
Merged PRs (30d)
253

Description

The `NetworkController` method `lookupNetwork` doesn't currently have a timeout. The default fetch timeout is quite long, leading to long delays in situations where we're waiting to know whether the network is accessible or not. We should add a timeout of 5 seconds. We can assume that networks that take longer than that to respond are inaccessible.

## Acceptance Criteria
- Add a timeout on the `lookupNetwork` method
- Add unit tests for this change

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the NetworkController implementation and its lookupNetwork method, then inspect the existing fetch timeout handling and nearby tests. Add coverage for the five-second timeout and verify that the tests demonstrate the method treating slower network responses as inaccessible.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
networking
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.