Skip to content

Remove CurrencyRateController start in background constructor#22326

Merged
jiexi merged 2 commits intodevelopfrom
jl/fix-currency-rate-controller-premature-start
Dec 18, 2023
Merged

Remove CurrencyRateController start in background constructor#22326
jiexi merged 2 commits intodevelopfrom
jl/fix-currency-rate-controller-premature-start

Conversation

@jiexi
Copy link
Copy Markdown
Member

@jiexi jiexi commented Dec 18, 2023

Description

Cryptocompare reported a spike in API requests. This is the result of incorrectly starting CurrencyRateController polling on MetaMask extension background startup. This PR fixes the issue by removing the logic that was starting CurrencyRateController polling in the constructor.

Related issues

Fixes: #21549

Manual testing steps

  1. Open network debug on background.html
  2. Restart extension
  3. No cryptocompare requests should be seen
  4. Open wallet UI
  5. One cryptocompare request should be seen
  6. Wait 3mins
  7. Another cryptocompare request should be seen
  8. Close UI
  9. Wait 3mins
  10. No additional cryptocompare requests should be seen

Screenshots/Recordings

Before

Note the requests made before the UI is open, but that they are stopped after UI is opened then closed for the first time.

Screen.Recording.2023-12-18.at.9.45.07.AM.mov

After

Screen.Recording.2023-12-18.at.9.43.25.AM.mov

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've clearly explained what problem this PR is solving and how it is solved.
  • I've linked related issues
  • I've included manual testing steps
  • I've included screenshots/recordings if applicable
  • I’ve included tests if applicable
  • I’ve documented my code using JSDoc format if applicable
  • I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.
  • I’ve properly set the pull request status:
    • In case it's not yet "ready for review", I've set it to "draft".
    • In case it's "ready for review", I've changed it from "draft" to "non-draft".

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@jiexi jiexi requested a review from a team as a code owner December 18, 2023 17:29
@github-actions
Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

adonesky1
adonesky1 previously approved these changes Dec 18, 2023
mcmire
mcmire previously approved these changes Dec 18, 2023
Copy link
Copy Markdown
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me!

@jiexi jiexi added the team-wallet-api-platform-deprecated DEPRECATED: please use "team-wallet-integrations" instead label Dec 18, 2023
@jiexi jiexi dismissed stale reviews from mcmire and adonesky1 via 376823f December 18, 2023 18:03
"conversionRate": 1700,
"usdConversionRate": 1700
"conversionRate": 1300,
"usdConversionRate": 1300
Copy link
Copy Markdown
Member Author

@jiexi jiexi Dec 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes failing e2e which reverts a value change from the offending PR. This test changing should have raised a flag for me to investigate further.

https://github.com/MetaMask/metamask-extension/pull/21549/files#diff-16a567d598793bb9001d6c8c282cfd1b06f9ed629620a63355bd7c24d78e637dR116

@jiexi jiexi merged commit 50b581d into develop Dec 18, 2023
@jiexi jiexi deleted the jl/fix-currency-rate-controller-premature-start branch December 18, 2023 18:26
@github-actions github-actions bot locked and limited conversation to collaborators Dec 18, 2023
@metamaskbot metamaskbot added the release-11.9.0 Issue or pull request that will be included in release 11.9.0 label Dec 18, 2023
@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [376823f]
Page Load Metrics (1394 ± 143 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint903541697435
domContentLoaded9199486129
load87619521394297143
domInteractive9199486129
Bundle size diffs [🚀 Bundle size reduced!]
  • background: -178 Bytes (-0.01%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-11.9.0 Issue or pull request that will be included in release 11.9.0 team-wallet-api-platform-deprecated DEPRECATED: please use "team-wallet-integrations" instead

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants