Skip to content

fix(core): refresh DigitalOcean routers while signed in - #58346

Closed
rekram1-node wants to merge 1 commit into
devfrom
do-router-refresh
Closed

rekram1-node wants to merge 1 commit into
devfrom
do-router-refresh

Conversation

@rekram1-node

Copy link
Copy Markdown
Contributor

Problem

#57175 stopped the DigitalOcean router poll because it ran in every open folder every 5 minutes, even when signed out, and reloaded the catalog on every tick. Since then, a router created mid-session only shows up after a restart or re-auth.

Change

The refresh is back, every 5 minutes, but only while signed in, and each tick is quiet unless the routers actually changed.

on startup, or when the DigitalOcean account changes:
    load routers
    if signed in (and the token hasn't expired):
        start a 5-minute loop (once per folder)
    otherwise:
        stop the loop

each tick:
    folders on the same token share one fetch per 5 minutes
    reload the catalog only if the router list changed
  • Signed out: no timer and no requests.
  • Folders signed in with the same token share one request per 5 minutes. The cache is keyed by the process HTTP client, so each test's client keeps its own.
  • An unchanged router list no longer reloads, so it sends no provider.updated.

Out of scope

  • The same refresh for Copilot, GitLab, Modal and Azure. They still fetch only at startup and on account changes.

Tested

  • Existing DigitalOcean tests pass.
  • I checked a throwaway scenario (not committed) with two plugin instances on one HTTP client:
Step Requests provider.updated
Signed out, 30 min 0
Sign in 1
Signed in, 15 min, same routers +3 total (one per 5 min, shared) 0
Router added, +5 min +1 new router shows up
Sign out, then 30 min 0

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No blocking problems found. Polling runs only while signed in and stops when you sign out or the token expires. A router added mid-session shows up on the next tick, and an unchanged router list no longer reloads the catalog.

How I checked: I ran a throwaway scenario with a mocked HTTP client and a simulated clock. Signed out, it made no requests. Signed in, it made one request per 5 minutes, and a new router appeared after one tick. Signing in again with a new token and the same routers kept them in the catalog. The existing DigitalOcean tests pass (10/10), and tsc -b for packages/core passes.

Public API: unchanged. This is an internal change to the plugin only.

No concerns.

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.

1 participant