Uh oh!
There was an error while loading. Please reload this page.
fix(assets-controller): bypass balance cache on every poll tick - #9926
Merged
Conversation
AccountsApiDataSource's recurring balance poll (default pollInterval 30s) fetches balances via ApiPlatformClient, which caches responses with STALE_TIMES.BALANCES (60s, in @metamask/core-backend). Since the poll's fetch() call didn't set forceUpdate, roughly half of its 30s ticks were silently served a cached response instead of hitting the network, so balances were effectively only refreshed every ~60s. Pass forceUpdate: true on every poll tick so it always bypasses the cache, matching the intended 30s cadence.
juanmigdr
enabled auto-merge
August 20, 2026 15:56
Prithpal-Sooriya
approved these changes
Aug 20, 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 freeto 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
AccountsApiDataSourcepolls for balances every 30s, but the underlyingApiPlatformClientcaches responses for 60s (STALE_TIMES.BALANCES). Since the poll didn't passforceUpdate, every other tick was served the cached response instead of hitting the network — balances only actually refreshed every ~60s.This passes
forceUpdate: trueon the poll's fetch call so it always bypasses the cache, same as other call sites (unlock, account switch, tx confirmation) already do.Kept the fix scoped to just the poll instead of removing caching everywhere, since #9591 added
forceUpdatespecifically to avoid bursts of duplicate calls when multiple triggers fire close together, and the unmerged #9867 ran into that regression by disabling the cache globally.References
Checklist
Note
Low Risk
Narrow cache-bypass on the 30s poll path only; does not change auth or other fetch sites. Slightly more Accounts API traffic on that interval, which is the intended behavior.
Overview
Fixes
AccountsApiDataSourcepolling serving stale balances on roughly every other tick. The 30s poll usedfetch()withoutforceUpdate, so the 60s TanStack balances cache (STALE_TIMES.BALANCES) won.Recurring
pollFnnow passesforceUpdate: trueso each tick hits the network (staleTime: 0, gcTime: 0), matching other authoritative refreshes. Bypass is scoped to the poll only so nearby unlock/switch/tx triggers still share the cache.Reviewed by Cursor Bugbot for commit d162463. Bugbot is set up for automated code reviews on this repo. Configure here.