fix(server): graceful shutdown with open SSE clients + bounded table growth #5
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/server-lifecycle-retention"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Two Important findings from the repo-wide review:
Graceful shutdown no longer hangs on open SSE connections. Fastify v5's default
forceCloseConnections: "idle"only closes idle keep-alive sockets; a connected EventSource keptapp.close()pending forever, so SIGTERM never reachedprocess.exit.buildApp()now passesforceCloseConnections: true. Regression test does a reallisten+ fetch on/api/stream, waits for the connected frame, and assertsapp.close()resolves within 2s (fails without the fix).market_alertsandsignal_outcomesno longer grow without bound. The hourly prune (pruneSnapshots→ renamedpruneOldRows) now also deletes both tables' rows older thanretentionDays(same window as snapshots —summarizeOutcomesfull-scans on every/api/outcomescall and the UI contract is recent-200 + summary, so no longer horizon is needed; documented in a comment).listPendingOutcomes(minTs)now takes a required floor — computed inOutcomeTracker.fillas the longest horizon (4h) + 24h grace — so permanently unpriceable symbols stop being re-fetched every minute forever.Tests: 56 files / 317 passing, typecheck clean.
b57b3d7e80to3b9dbb7dca