NftController.updateNftMetadata called with too many NFTs at once causes 429 error
- Dominant language
- TypeScript
- Stars
- 413
- Forks
- 308
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 253
Description
## Issue
I have about 1949 nfts on base sepolia testnet
using sepolia.base.org as a provider
most of those nfts are testing nfts that have broken images (empty string)
the NftController.updateNftMetadata is beign called with too many nfts at once (see attached images)
## Cause
the issue is caused by using Promise.all to call getNftInformation
https://github.com/MetaMask/core/blob/5d9f45cfa6a2bf8d774302dc3a0bb7ade7dd7a2e/packages/assets-controllers/src/NftController.ts#L1582-L1594
## Proposed Solutions
instead should limit the number of the getNftInformation calls at once
could use one of those packages
https://www.npmjs.com/package/promise-concurrency
https://www.npmjs.com/package/promise-limit
or should only refresh a few broken nfts each time, and keep track of the last updated timestamp
## Images from MetaMask extension service worker on chrome


Contributor guide
No contributing guide indexed for this repository
Research direction
Start in packages/assets-controllers/src/NftController.ts at lines 1582-1594, where Promise.all calls getNftInformation during updateNftMetadata. Review the surrounding controller flow and determine how concurrent requests should be bounded or refreshed incrementally. Done means large NFT batches no longer trigger provider 429 errors while metadata updates still complete.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100