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 setInterval for polling in CollectibleDetectioncontroller #15935

Closed
NiranjanaBinoy opened this issue Sep 21, 2022 · 3 comments
Closed
Labels

Comments

@NiranjanaBinoy
Copy link
Contributor

NiranjanaBinoy commented Sep 21, 2022

Replace setInterval for polling in detectCollectibles() in CollectibleDetectioncontroller 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?

@NiranjanaBinoy
Copy link
Contributor Author

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