fix: honor server-recommended poll interval for config fetches#392
Merged
myleshorton merged 2 commits intomainfrom Mar 31, 2026
Merged
fix: honor server-recommended poll interval for config fetches#392myleshorton merged 2 commits intomainfrom
myleshorton merged 2 commits intomainfrom
Conversation
The config poll loop was hardcoded to the client's default interval (10 minutes) regardless of what the server recommended. The server sends poll_interval_seconds in the config response (60s for new ASNs, up to 900s when converged) to control bandit learning speed. Now reads PollIntervalSeconds from the latest config after each fetch and uses it for the next poll delay. Falls back to the default if the server doesn't send one. Floors at 10 seconds to prevent abuse. Also updates getlantern/common to pick up PollIntervalSeconds field. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the client config polling loop to respect the server-provided poll_interval_seconds value (used by the bandit learning system to dynamically control fetch cadence), instead of always polling at a fixed default interval.
Changes:
- Update
ConfigHandler.fetchLoopto select the next poll delay fromConfigResponse.PollIntervalSecondswhen present (otherwise fall back to the default interval). - Add a minimum-interval guard to avoid excessively frequent polling.
- Bump
github.com/getlantern/commondependency to a version that includes the newPollIntervalSecondsfield.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
config/config.go |
Uses server-recommended poll interval from config response for subsequent poll delays. |
go.mod |
Updates github.com/getlantern/common to a newer pseudo-version. |
go.sum |
Updates checksums corresponding to the common dependency bump. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
If server sends < 10s, clamp to 10s rather than reverting to the 10-minute default. Tests noted as follow-up. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
The config poll loop used a hardcoded 10-minute interval, ignoring the server's
poll_interval_secondsfield. The server dynamically adjusts this based on bandit learning confidence:With 10-minute polling, the bandit got 6 observations/hour instead of 60 — making learning 10x slower than intended.
Fix: After each config fetch, read
PollIntervalSecondsfrom the response and use it for the next poll delay. Falls back to the default (10 min) if not set. Floors at 10s.Also updates
getlantern/commonto include thePollIntervalSecondsfield.Test plan
🤖 Generated with Claude Code