fix: remove context reaper to prevent background tabs from going stale
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.
This commit is contained in:
@@ -66,7 +66,6 @@ v.Config(via.Options{
|
||||
Plugins: []via.Plugin{MyPlugin},
|
||||
SessionManager: sm,
|
||||
PubSub: customBackend,
|
||||
ContextTTL: 60 * time.Second,
|
||||
ActionRateLimit: via.RateLimitConfig{Rate: 20, Burst: 40},
|
||||
})
|
||||
```
|
||||
@@ -83,7 +82,6 @@ v.Config(via.Options{
|
||||
| `DatastarContent` | (embedded) | Custom Datastar JS bytes |
|
||||
| `DatastarPath` | `"/_datastar.js"` | URL path for the Datastar script |
|
||||
| `PubSub` | embedded NATS | Custom PubSub backend. Replaces the default NATS. See [PubSub and Sessions](pubsub-and-sessions.md) |
|
||||
| `ContextTTL` | `30s` | Max time a context survives without an SSE connection before cleanup. Negative value disables the reaper |
|
||||
| `ActionRateLimit` | `10 req/s, burst 20` | Default token-bucket rate limiter for action endpoints. Rate of `-1` disables limiting |
|
||||
|
||||
## Static Files
|
||||
|
||||
Reference in New Issue
Block a user