MetaMask / MetaMask/core

Remove legacy polling code from TokenRatesController

Open
#3,632 0 comments 0 reactions 0 assignees View on GitHub
team-assets team-wallet-framework wf-controller-tech-debt
Dominant language
TypeScript
Stars
413
Forks
308
Avg merge
1d 4h
Merged PRs (30d)
253

Description

There are two polling strategies represented in TokenRatesController:

1. The original strategy, which always fetches rates for the globally selected network. To use this, you call `start` to start the loop and `stop` to stop the loop. The loop itself is implemented via `#poll`.
2. The new strategy as represented via the PollingController, which allows for fetching rates for arbitrary networks. To use this, you start a new loop by using `startPollingByNetworkClientId`, passing the ID of a network client; you can also stop an existing loop via `stopPollingByPollingToken`, or stop all loops by calling `stopAllPolling`. Internally, a loop is implemented via `_executePoll`.

Maintaining the original polling strategy costs time and effort, as we have to update the tests associated with the methods mentioned above every time we update TokenRatesController. We can remove them and ask clients to use the new polling API.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating TokenRatesController and the tests for start, stop, and poll, then compare them with PollingController and its _executePoll implementation. Remove the legacy polling strategy and update the affected tests and clients to use startPollingByNetworkClientId, stopPollingByPollingToken, or stopAllPolling; done means the old API and its tests are gone.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, backend
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.