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

fix: notification slowness and crashes #25946

Merged
merged 7 commits into from
Jul 19, 2024

Conversation

Prithpal-Sooriya
Copy link
Contributor

@Prithpal-Sooriya Prithpal-Sooriya commented Jul 18, 2024

Description

This is a series of fixes added to core libraries. Adding to extension, and soon we will migrate extension to use shared libraries.

Open in GitHub Codespaces

Related issues

MetaMask/core#4530
MetaMask/core#4531
MetaMask/core#4532
MetaMask/core#4533
MetaMask/core#4536

#25749

Manual testing steps

  1. Create multiple accounts
  2. Go to notification settings page
  3. Wait for settings to load, and try toggling notifications

Before: some settings would error or not load
After: you should be able to toggle accounts and not see errors.

Screenshots/Recordings

Before

After

https://www.loom.com/share/49b582e8c33b4199bdafc994a3f6087f?sid=9f94a885-351b-4fee-84d8-f72c97506e7d

Pre-merge author checklist

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.

making multiple calls to snaps can cause internal 429 responses and requests become queued. This adds simple in-memory caching to prevent calling the snap with same values
interesting bug that happens with communication with our controllers. Removing the calls to disable profile sync, and instead we will add this edge case on the UI or better orchestrate comms.
as notifications are coming from multiple data sources, if a data source is retrying, then notifications will take longer to load.
@Prithpal-Sooriya Prithpal-Sooriya added the team-notifications Notifications team label Jul 18, 2024
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.

@metamaskbot
Copy link
Collaborator

Builds ready [f8f0dae]
Page Load Metrics (237 ± 243 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint74146101209
domContentLoaded86524157
load401862237505243
domInteractive86524157
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 561 Bytes (0.02%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@Prithpal-Sooriya Prithpal-Sooriya marked this pull request as ready for review July 18, 2024 16:46
@Prithpal-Sooriya Prithpal-Sooriya requested a review from a team as a code owner July 18, 2024 16:46
@metamaskbot
Copy link
Collaborator

Builds ready [5f76720]
Page Load Metrics (151 ± 191 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint6213191178
domContentLoaded95323136
load401883151398191
domInteractive95322136
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 561 Bytes (0.02%)
  • ui: 1.08 KiB (0.01%)
  • common: 0 Bytes (0.00%)

Copy link

codecov bot commented Jul 18, 2024

Codecov Report

Attention: Patch coverage is 30.85106% with 65 lines in your changes missing coverage. Please review.

Project coverage is 69.67%. Comparing base (e562224) to head (3902451).

Files Patch % Lines
...s/metamask-notifications/useSwitchNotifications.ts 0.00% 30 Missing ⚠️
...ns-settings/notifications-settings-per-account.tsx 0.00% 18 Missing ⚠️
.../notifications-settings/notifications-settings.tsx 0.00% 10 Missing ⚠️
...s/metamask-notifications/metamask-notifications.ts 66.67% 3 Missing ⚠️
...ollers/authentication/authentication-controller.ts 81.82% 2 Missing ⚠️
...sk-notifications/services/feature-announcements.ts 88.89% 1 Missing ⚠️
...ontrollers/user-storage/user-storage-controller.ts 83.33% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #25946      +/-   ##
===========================================
- Coverage    69.70%   69.67%   -0.03%     
===========================================
  Files         1400     1400              
  Lines        49464    49510      +46     
  Branches     13687    13689       +2     
===========================================
+ Hits         34478    34494      +16     
- Misses       14986    15016      +30     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@matteoscurati matteoscurati left a comment

Choose a reason for hiding this comment

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

I found two edge cases regarding state management, but they involve behaviors that a user normally wouldn’t apply and, in any case, they don’t cause issues in managing the extension’s state. We can approve this PR and look into further optimizing this page in the future :)

Copy link

sonarcloud bot commented Jul 19, 2024

@metamaskbot
Copy link
Collaborator

Builds ready [3902451]
Page Load Metrics (70 ± 9 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint6214099189
domContentLoaded106426147
load4211070189
domInteractive106426147
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 561 Bytes (0.02%)
  • ui: 1.08 KiB (0.01%)
  • common: 0 Bytes (0.00%)

@Prithpal-Sooriya Prithpal-Sooriya merged commit 003ee98 into develop Jul 19, 2024
79 checks passed
@Prithpal-Sooriya Prithpal-Sooriya deleted the fix-notification-slowness-and-crashes branch July 19, 2024 11:13
@github-actions github-actions bot locked and limited conversation to collaborators Jul 19, 2024
@metamaskbot metamaskbot added the release-12.3.0 Issue or pull request that will be included in release 12.3.0 label Jul 19, 2024
@Prithpal-Sooriya Prithpal-Sooriya added the release-12.0.0 Issue or pull request that will be included in release 12.0.0 label Jul 19, 2024
@metamaskbot metamaskbot removed the release-12.3.0 Issue or pull request that will be included in release 12.3.0 label Aug 15, 2024
@metamaskbot
Copy link
Collaborator

More than one release label on PR. Keeping the lowest one (release-12.0.0) on PR and removing other release labels (release-12.3.0).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.0.0 Issue or pull request that will be included in release 12.0.0 team-notifications Notifications team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants