Sync thread subscriptions on boot and reconnect, throttled and staggered
The threads view rendered cache-only on startup, the socket replays nothing, and the only subscriptions.thread.getView sync ran once per session on first Threads-view open (sync.Once). After any offline gap — app closed for days, laptop asleep — the thread_subscriptions table stayed stale for the whole session. - Fire EnsureSubscriptions on workspace-ready for every workspace (resolved via router.ByID, so background Grid workspaces sync too); activation stays as a safety-net trigger. - Replace the sync.Once with threadSubsGate: at most one paginated sweep per 30-minute window per workspace, never two concurrently. - Stagger each workspace's first sync (slot x 15s) so an Enterprise Grid boot doesn't fire N ~62-request sweeps in the same second. - Kick the gated sync from the reconnect/wake catch-up; the gate owns the throttling, so the kick is free when a sync is recent. - Honor HTTP 429 Retry-After in postForm and retry the same getView page, bounded to 3 retries, instead of hard-failing the sweep.
G
Grant Ammons committed
2693c0947f6a65f17902a1178b1ec9739c0c156d
Parent: cdc6eb1