fix: remove context reaper to prevent background tabs from going stale #4

Merged
ryan merged 1 commits from worktree-remove-reaper into main 2026-02-20 19:11:12 +00:00
Owner

Background windows stopped updating because the reaper suspended contexts after ContextSuspendAfter (15 min default) and fully reaped them after ContextTTL (1 hour default). Suspended contexts had to re-run the page init function from scratch on reconnect, losing the live-updating experience.

Contexts now live until the browser tab closes (beforeunload beacon) or the server shuts down. The context map grows indefinitely — no background reaper.

Changes

  • via.go: Remove reaperStop field, startReaper(), reapOrphanedContexts(), reaper lifecycle calls, lastSeenAt SSE update, suspend-resume SSE block, ContextSuspendAfter/ContextTTL config handling
  • context.go: Remove lastSeenAt/suspended fields and suspend() method
  • configuration.go: Remove ContextSuspendAfter/ContextTTL option fields
  • via_test.go: Remove 10 reaper-related tests, keep TestCleanupCtxIdempotent
  • docs/getting-started.md: Remove ContextTTL from config example and options table
  • docs/state-and-interactivity.md: Update lifecycle description (no background reaper)
Background windows stopped updating because the reaper suspended contexts after `ContextSuspendAfter` (15 min default) and fully reaped them after `ContextTTL` (1 hour default). Suspended contexts had to re-run the page init function from scratch on reconnect, losing the live-updating experience. Contexts now live until the browser tab closes (`beforeunload` beacon) or the server shuts down. The context map grows indefinitely — no background reaper. ## Changes - **`via.go`**: Remove `reaperStop` field, `startReaper()`, `reapOrphanedContexts()`, reaper lifecycle calls, `lastSeenAt` SSE update, suspend-resume SSE block, `ContextSuspendAfter`/`ContextTTL` config handling - **`context.go`**: Remove `lastSeenAt`/`suspended` fields and `suspend()` method - **`configuration.go`**: Remove `ContextSuspendAfter`/`ContextTTL` option fields - **`via_test.go`**: Remove 10 reaper-related tests, keep `TestCleanupCtxIdempotent` - **`docs/getting-started.md`**: Remove `ContextTTL` from config example and options table - **`docs/state-and-interactivity.md`**: Update lifecycle description (no background reaper)
ryan added 1 commit 2026-02-20 18:49:56 +00:00
fix: remove context reaper to prevent background tabs from going stale
Some checks failed
CI / Build and Test (push) Failing after 37s
CI / Build and Test (pull_request) Failing after 36s
4191302cb8
Background windows stopped updating because the reaper suspended contexts
after ContextSuspendAfter and fully reaped them after ContextTTL. Suspended
contexts had to re-run the page init function from scratch on reconnect,
losing the live-updating experience.

Contexts now live until the browser tab closes (beforeunload beacon) or
the server shuts down. The context map grows indefinitely — no background
reaper.

Removes: startReaper, reapOrphanedContexts, suspend/resume logic,
ContextSuspendAfter/ContextTTL config fields, lastSeenAt/suspended
context fields, and all associated tests.
ryan force-pushed worktree-remove-reaper from 4191302cb8 to b3c2d3ae32 2026-02-20 19:09:06 +00:00 Compare
ryan merged commit dc56261b58 into main 2026-02-20 19:11:12 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ryan/via#4