Skip to content

fix: honor server-recommended poll interval for config fetches#392

Merged
myleshorton merged 2 commits intomainfrom
fix/honor-server-poll-interval
Mar 31, 2026
Merged

fix: honor server-recommended poll interval for config fetches#392
myleshorton merged 2 commits intomainfrom
fix/honor-server-poll-interval

Conversation

@myleshorton
Copy link
Copy Markdown
Contributor

Summary

The config poll loop used a hardcoded 10-minute interval, ignoring the server's poll_interval_seconds field. The server dynamically adjusts this based on bandit learning confidence:

  • 60s for new ASNs (need data fast)
  • 180s–600s as confidence grows
  • 900s when fully converged

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 PollIntervalSeconds from 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/common to include the PollIntervalSeconds field.

Test plan

  • Build client, verify config fetches at server-recommended interval (60s for new ASN)
  • Verify interval increases as bandit converges
  • Verify fallback to 10 min when field is absent

🤖 Generated with Claude Code

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>
Copilot AI review requested due to automatic review settings March 31, 2026 20:31
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.fetchLoop to select the next poll delay from ConfigResponse.PollIntervalSeconds when present (otherwise fall back to the default interval).
  • Add a minimum-interval guard to avoid excessively frequent polling.
  • Bump github.com/getlantern/common dependency to a version that includes the new PollIntervalSeconds field.

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>
@myleshorton myleshorton merged commit 2ad0783 into main Mar 31, 2026
2 checks passed
@myleshorton myleshorton deleted the fix/honor-server-poll-interval branch March 31, 2026 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants