fix(assets-controller): clean up unused assetsInfo/assetsPrice entries on startup - #9806
Open
Prithpal-Sooriya wants to merge 14 commits into
Open
fix(assets-controller): clean up unused assetsInfo/assetsPrice entries on startup#9806Prithpal-Sooriya wants to merge 14 commits into
Prithpal-Sooriya wants to merge 14 commits into
Conversation
…e entries on startup Co-authored-by: Prithpal Sooriya <prithpal.sooriya@gmail.com>
Co-authored-by: Prithpal Sooriya <prithpal.sooriya@gmail.com>
Prithpal-Sooriya
commented
Aug 7, 2026
Prithpal-Sooriya
commented
Aug 7, 2026
…rt cycle Co-authored-by: Prithpal Sooriya <prithpal.sooriya@gmail.com>
Co-authored-by: Prithpal Sooriya <prithpal.sooriya@gmail.com>
Co-authored-by: Prithpal Sooriya <prithpal.sooriya@gmail.com>
Prithpal-Sooriya
commented
Aug 7, 2026
…/flatMap Co-authored-by: Prithpal Sooriya <prithpal.sooriya@gmail.com>
Co-authored-by: Prithpal Sooriya <prithpal.sooriya@gmail.com>
Co-authored-by: Prithpal Sooriya <prithpal.sooriya@gmail.com>
Co-authored-by: Prithpal Sooriya <prithpal.sooriya@gmail.com>
Co-authored-by: Prithpal Sooriya <prithpal.sooriya@gmail.com>
Co-authored-by: Prithpal Sooriya <prithpal.sooriya@gmail.com>
Prithpal-Sooriya
marked this pull request as ready for review
August 10, 2026 09:56
Prithpal-Sooriya
temporarily deployed
to
default-branch
August 10, 2026 09:56 — with
GitHub Actions
Inactive
Co-authored-by: Prithpal Sooriya <prithpal.sooriya@gmail.com>
Co-authored-by: Prithpal Sooriya <prithpal.sooriya@gmail.com>
Co-authored-by: Prithpal Sooriya <prithpal.sooriya@gmail.com>
salimtb
reviewed
Aug 10, 2026
| const isUnused = (assetId: string): boolean => | ||
| !keptAssetIds.has(assetId.toLowerCase()) && !isNativeAssetId(assetId); | ||
|
|
||
| for (const slice of [state.assetsInfo, state.assetsPrice]) { |
Contributor
There was a problem hiding this comment.
nit
Suggested change
| for (const slice of [state.assetsInfo, state.assetsPrice]) { | |
| for (const assetId of Object.keys(slice)) { | |
| if (isUnused(assetId)) { | |
| delete slice[assetId]; | |
| } | |
| } |
salimtb
approved these changes
Aug 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation
AssetsController'sassetsInfoandassetsPricestate slices have never had a delete path: metadata and prices are written whenever assets are fetched or detected, but entries are never removed when the assets stop being referenced. Since both slices are persisted, they grow unbounded over time.This PR adds a cleanup utility that gets invoked once (through
#runStartupRefresh)References
https://consensyssoftware.atlassian.net/browse/ASSETS-3844
Checklist