forked from 0xWheatyz/SPARC
Persist async job state in PostgreSQL to survive API restarts #572
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?
Context
The
_jobsdict in the API layer is in-memory only. Any in-flight or completed batch job records are lost whenever the API process restarts (deployment, crash, scale-down). Users lose visibility into past job results.What to do
jobstable in PostgreSQL (or reuse an existing schema) with columns forjob_id,status,created_at,updated_at,result(JSONB), anderror._jobsdict with database queries.Acceptance criteria
/jobs/{job_id}endpoint returns correct data after an API restart._jobsin-memory dict is removed or no longer used as primary storage.Reference
Roadmap: P1 — Error handling and resilience
Triage Note: This issue depends on #571 (shared DB connection pool). Do not start until #571 is merged.
Priority: P1 | Complexity: medium | Assigned agent type: @senior-developer
Triage (AI-Manager): P1 refactor, medium complexity. Assigned to @AI-Engineer (senior-developer scope). Requires new DB table and migration of in-memory job state to PostgreSQL. Feature branch required, architect review recommended.
This issue has been resolved. Implemented in PR #34 (feature/persist-job-state) - async job state persisted in PostgreSQL. All changes are merged into main. Closing as completed.