Re-arm queued calculation jobs on startup and shut down gracefully #30
Labels
No labels
bug
decision
docs
enhancement
integration
ops
security
tech-debt
testing
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
rbrooks/BatteryStorageCalculator#30
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Recompute scheduling is an in-process
setTimeout(...).unref()(backend/src/app.js:43-69). On restart,recoverAbandonedJobs(repository.pg.js:442-452) marksrunningjobs failed but never re-armsqueuedones; they only run again if that home's calculation status is polled (app.js:191-193).server.jsinstalls no signal handlers and never callsrepository.close(), so docker stop drops timers and connections mid-flight.Fix: (1) at startup, list due
queuedcalculation jobs and schedule them; (2) add SIGTERM/SIGINT handlers: stop accepting connections, await in-flight calculation runs,pool.end(). Consider replacing per-change timers with a single interval poller overclaimDueCalculationJob(already SKIP LOCKED-safe) if a second replica ever appears.Acceptance criteria
Relations: relates to #16
(Audit finding F-09, 2026-07-16 — Severity: Medium, Confidence: High)