feat: add requestPeriodicUpdate method to SnapRegistryController#4043
Merged
Conversation
Adds a `periodicFetchThreshold` option (default 4 hours) and a `requestPeriodicUpdate` method that skips the update when the registry was fetched within that threshold, reducing unnecessary network requests while still keeping the database reasonably up to date.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4043 +/- ##
=======================================
Coverage 98.58% 98.58%
=======================================
Files 425 425
Lines 12364 12371 +7
Branches 1948 1950 +2
=======================================
+ Hits 12189 12196 +7
Misses 175 175 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 6554437. Configure here.
Ensures callers can observe when `requestPeriodicUpdate` skips the fetch because the registry was recently fetched, consistent with the other early-exit paths in `#update`.
Adds the method to `MESSENGER_EXPOSED_METHODS`, and updates tests to call through the messenger.
…roller.ts Co-authored-by: Frederik Bolding <frederik.bolding@gmail.com>
FrederikBolding
approved these changes
Jun 24, 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.

Summary
Adds a
periodicFetchThresholdoption (default: 4 hours) and a publicrequestPeriodicUpdatemethod toSnapRegistryController.The new method is similar to
requestUpdate, but skips the update if the registry was fetched within the periodic threshold. This is useful for callers that want to keep the registry reasonably up to date on a longer interval (e.g., on wallet unlock) without triggering a fetch on every call.Note
Low Risk
Additive API and config with tests; existing
requestUpdatebehavior is unchanged.Overview
Adds
requestPeriodicUpdateonSnapRegistryControllerso callers can refresh the snap allowlist registry on a longer cadence (default 4 hours) without hitting the existing 5-minute “recent fetch” guard used byrequestUpdate.The controller gains a configurable
periodicFetchThresholdand refactors#wasRecentlyFetchedto accept an optional threshold. When the last fetch is still inside that window,requestPeriodicUpdateno-ops and publishesregistryUpdatedwithfalse; otherwise it delegates torequestUpdate. Messenger action types and unit tests cover first fetch, skip-within-threshold, and fetch-after-threshold behavior.Reviewed by Cursor Bugbot for commit c9343e1. Bugbot is set up for automated code reviews on this repo. Configure here.