fix: add aggressive fetching behaviour for first time for subnet_info#185
Merged
shilingwang merged 4 commits intomainfrom Mar 20, 2026
Merged
fix: add aggressive fetching behaviour for first time for subnet_info#185shilingwang merged 4 commits intomainfrom
shilingwang merged 4 commits intomainfrom
Conversation
r-birkner
approved these changes
Mar 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 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
SubnetsInfoFetcheris a background task that periodically refreshes the NNS routing table and subnet-type snapshot. Previously it would wait for the full polling interval (default 5 min) between every attempt, even on startup when no snapshot had ever been fetched. This meant the gateway could be functionally unready for up to 5 minutes on a cold start if the first fetch failed.This PR makes the first successful fetch aggressive: if
SubnetsInfoFetcher.infois None (i.e. no snapshot has been populated yet), therun()method enters a tight retry loop with a 5-second back-off instead of returning and waiting for the normal interval. Once the first fetch succeeds the loop exits, theTaskManagerinterval takes over, and subsequent refreshes follow the configured--subnets-info-poll-intervalas before.Changes
src/routing/ic/subnets_info.rsAdded
AGGRESSIVE_RETRY_INTERVALconstant (5 s).Rewrote
Run::run()to split into two paths:Healthy path (info is Some): single fetch, returns immediately — no behavioural change.
Bootstrap path (info is None): retry loop with
tokio::select!over the 5-second sleep and the shutdownCancellationToken, so it exits cleanly on service shutdown.