Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace setTimeout for polling in TokenRatesController #15977

Closed
NiranjanaBinoy opened this issue Sep 26, 2022 · 2 comments
Closed

Replace setTimeout for polling in TokenRatesController #15977

NiranjanaBinoy opened this issue Sep 26, 2022 · 2 comments
Assignees
Labels

Comments

@NiranjanaBinoy
Copy link
Contributor

NiranjanaBinoy commented Sep 26, 2022

Replace setTimeout for polling in updateExchangeRates() in TokenRatesController in a time window of 3 minutes.

@NiranjanaBinoy
Copy link
Contributor Author

The corresponding PR has to be created in the controller repo.

Since the chrome alarms have to be used only for the extension, we would have to configure them at the API level to differentiate extension using mv3 from mobile and extension using mv2.
Can we introduce a new optional state variable with true value to identify extension with mv3 and use chrome alarms in that case?

Something similar to MetaMask/core#861

@NiranjanaBinoy
Copy link
Contributor Author

Closing this ticket after a conversation with the core team. Quoting the comment below and link to the chat here

Using setTimeout might be fine for the intervals that are below 5 minutes. That's not awful.
If the service worker restarts every 5 minutes, then the 3-minute intervals will be triggered once every 2.5 minutes on average. That seems fine.
Though I would check to ensure that the update is triggered upon construction as well. If it's only after 3 minutes has elapsed, then it would become a 5 minute timer in practice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant