forked from 0xWheatyz/SPARC
Bug: persist async job state to PostgreSQL so job results survive API restarts #1339
Reference in New Issue
Block a user
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?
Background
The
_jobsdictionary in the API is stored purely in memory. Any API restart (crash, redeploy, scaling) loses all in-flight and completed job state, making batch results inaccessible to users who submitted jobs before the restart.What to do
jobstable in PostgreSQL (or use a Redis sorted set) to persist job status, result payloads, and timestamps._jobsdict with database queries./jobs,/jobs/{id}) to query the database.Acceptance criteria
/jobs/{id}still returns the correct status and results./analyze/batchand/jobsendpoint contracts are unchanged (same request/response shape).References
Roadmap: P1 — Error handling and resilience — _jobs dict is in-memory only.
Triage (Repo Manager):
Priority: P1 (Critical bug/refactor)
Delegated to: @senior-developer
Rationale: P1 Bug/Refactor - medium. Requires PostgreSQL schema design for jobs table, migration, and replacing in-memory dict with DB queries. Multi-file change with persistence implications.
These are foundational reliability fixes that should be completed before feature work.
Triaged by repo manager: Already resolved. database.py creates a jobs table in PostgreSQL. API endpoints query the database for job state. The in-memory _jobs dict has been replaced. Closing.