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

v11.7.1 cherrypick: Fix CurrencyRateController starting in background (#22326) #22328

Conversation

jiexi
Copy link
Contributor

@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.

Description

Related issues

Fixes:

Manual testing steps

  1. Go to this page...

Screenshots/Recordings

Before

After

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.

## **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**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **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.


https://github.com/MetaMask/metamask-extension/assets/918701/c66eabd0-363b-467a-87e3-5628daa95395

### **After** 


https://github.com/MetaMask/metamask-extension/assets/918701/3676fa9d-4b6f-4c4d-941d-eac7b0ab7194

## **Pre-merge author checklist**

- [ ] I’ve followed [MetaMask Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've clearly explained what problem this PR is solving and how it
is solved.
- [x] I've linked related issues
- [x] I've included manual testing steps
- [x] I've included screenshots/recordings if applicable
- [x] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
- [x] I’ve properly set the pull request status:
  - [ ] In case it's not yet "ready for review", I've set it to "draft".
- [x] 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.
Copy link
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.

@jiexi jiexi requested a review from danjm December 18, 2023 19:13
@danjm danjm merged commit 9170f5f into Version-v11.7.1 Dec 18, 2023
63 of 65 checks passed
@danjm danjm deleted the jl/Version-v11.7.1-cherry-pick-currencyRateController-fix branch December 18, 2023 19:34
@github-actions github-actions bot locked and limited conversation to collaborators Dec 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants