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

Optimize TokenBalancesController and TokenRatesController #6066

Open
tommasini opened this issue Mar 29, 2023 · 2 comments
Open

Optimize TokenBalancesController and TokenRatesController #6066

tommasini opened this issue Mar 29, 2023 · 2 comments

Comments

@tommasini
Copy link
Contributor

tommasini commented Mar 29, 2023

Description

This issue aims to optimize the TokenBalancesController and TokenRatesController on the assets-controller.
Now, both controllers are fetching the balance and rates multiple times in a few seconds with the mobile app.

We need to debug and refactor them keeping in mind they are not only used for the mobile app.

There are more details in this document.

Technical Details

TokenRatesController

Option1:

  • Implement a mutex on TokenRatesController on fetchAndUpdateExchangeRates

Option2:

  • Implement all the situations that we would need for the fetchAndUpdateExchangeRates to be called.

TokenBalancesController

  • Try the same options as of TokenRatesController

Acceptance Criteria

  • Endpoints do not fail because are being requested too many times
  • UI/UX of the token list improved thanks to this performance optimization.

Scenario: User detect tokens on mainnet

  • GIVEN a user have 15 tokens to detect
  • WHEN a user detect that tokens
  • THEN Token native and fiat balance should not fail to fetch.

References

  • References go here.
  • Issue numbers. Links.
  • Slack threads.
  • Etc.
@gauthierpetetin
Copy link
Contributor

gauthierpetetin commented Mar 30, 2023

Suggestions:

Split this ticket into 2 tickets:

  • One for TokenRatesController
  • One for TokenBalancesController

Make a choice between:

  • Option1 [best option if it works] - The function is locked while we do a request.
  • Option2 - Audit the mobile app code to understand why we use it at different places in the application, then reduce the number.

@tommasini
Copy link
Contributor Author

For Token Rates Controller -> #6100
For Token Balances Controller -> #6101

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

No branches or pull requests

2 participants