-
Notifications
You must be signed in to change notification settings - Fork 81
Add reconnect-with-backoff and missed-event recovery to the Activity SSE stream #258
Copy link
Copy link
Closed
Labels
GrantFox OSSGrantFox Open Source Sponsorship program tagGrantFox Open Source Sponsorship program tagMaybe RewardedIssue may qualify for a reward upon successful completion per campaign rulesIssue may qualify for a reward upon successful completion per campaign rulesOfficial Campaign | FWC26Official FWC26 campaign issue — eligible for campaign scoring and rewardsOfficial FWC26 campaign issue — eligible for campaign scoring and rewardsdashboardAutomatically createdAutomatically createdenhancementImprovement or extension to existing project functionality, architecture, or developer experienceImprovement or extension to existing project functionality, architecture, or developer experiencehelp wantedExtra attention is neededExtra attention is neededperformancePerformance optimization or latency/throughput improvement workPerformance optimization or latency/throughput improvement work
Description
Activity
Metadata
Metadata
Assignees
Labels
GrantFox OSSGrantFox Open Source Sponsorship program tagGrantFox Open Source Sponsorship program tagMaybe RewardedIssue may qualify for a reward upon successful completion per campaign rulesIssue may qualify for a reward upon successful completion per campaign rulesOfficial Campaign | FWC26Official FWC26 campaign issue — eligible for campaign scoring and rewardsOfficial FWC26 campaign issue — eligible for campaign scoring and rewardsdashboardAutomatically createdAutomatically createdenhancementImprovement or extension to existing project functionality, architecture, or developer experienceImprovement or extension to existing project functionality, architecture, or developer experiencehelp wantedExtra attention is neededExtra attention is neededperformancePerformance optimization or latency/throughput improvement workPerformance optimization or latency/throughput improvement work
Difficulty: Advanced
Type: Performance
Background
.env.exampledocumentsNEXT_PUBLIC_ACTIVITY_REFRESH_MSas an "Activity delivery fallback interval," describing automatic SSE with a polling fallback, and notes that setting it to0"disable[s] automatic SSE and polling while retaining manual refresh." This confirms the/activitypage relies on a live SSE connection with polling as a secondary mechanism.Problem
There's no documented or apparent handling for what happens when the SSE connection drops (network blip, server restart, proxy timeout): does the client silently stop receiving updates until a manual refresh, does it retry immediately in a tight loop, and are events that occurred during the disconnect window lost entirely? None of this is addressed by the simple polling-interval fallback alone.
Expected outcome
The activity feed client detects SSE disconnects, retries the connection using exponential backoff with jitter (capped at a sane maximum), and on reconnect, requests any activity events that occurred after the last event it successfully received (using a timestamp or event-id cursor) so no events are silently lost during a disconnect window shorter than the outage-recovery threshold.
Suggested implementation
lastEventId/lastSeenTimestampcursor tracked client-side (and ideally acknowledged server-side via SSE's nativeLast-Event-IDsupport)./verifycommand #1, if implemented) with anafter=<cursor>parameter to backfill missed events before resuming the live stream.NEXT_PUBLIC_ACTIVITY_REFRESH_MS=0should still allow manual refresh only, unchanged).Acceptance criteria
NEXT_PUBLIC_ACTIVITY_REFRESH_MS) is unaffected for environments where SSE is disabled.pnpm --filter @guildpass/dashboard testandpnpm typecheckpass.Likely affected files/directories
apps/dashboard/app/activity/, activity SSE route/handler (apps/dashboard/app/api/activity/**or equivalent), client-side activity feed hook/component.