Skip to content

Throttle repeated cloud proxy rebuilds - #7536

Open
yophilav wants to merge 2 commits into
mainfrom
fix/7535-cloud-proxy-rebuild-cooldown
Open

Throttle repeated cloud proxy rebuilds#7536
yophilav wants to merge 2 commits into
mainfrom
fix/7535-cloud-proxy-rebuild-cooldown

Conversation

@yophilav

@yophilav yophilav commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Five-second per-device cooldown: outcome-based failed or rapidly inactive cloud proxy creation is throttled per device; initial creation and the first replacement remain immediate.
  • Monotonic timing: cooldown elapsed time uses Stopwatch.GetTimestamp() with Stopwatch.Frequency arithmetic instead of wall-clock time.
  • Atomic active and handoff state separation: normal lookup sees only the active connection, while a separate preserved connection is available only for a pending token handoff.
  • Generation fencing and serialized removal: per-device connection state uses a generation counter so stale creation or update results cannot overwrite a newer removal.
  • Token-waiter atomic state and stale callback suppression: the TaskCompletionSource token waiter is atomically published and cleared; cancellation suppresses stale TokenNearExpiry callbacks.
  • Connection cleanup: canceled, displaced, superseded, and invalidated connections are removed from state and closed.

Fixes #7535

Testing

  • ConnectionManagerTest and RetryingCloudProxyTest: 34 passed
  • ClientTokenCloudConnectionTest: 9 passed

Reuse recently completed retry connection attempts per device so queued operations cannot trigger a sequential rebuild stampede when replacements immediately become inactive.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0b428cdd-2248-4f74-87b1-cd02dc9ad50a
Coalesce failed per-device rebuild attempts, fence concurrent removals, and preserve token handoff without exposing stale connections to normal lookup.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0b428cdd-2248-4f74-87b1-cd02dc9ad50a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant