forked from 0xWheatyz/SPARC
Persist async job state in PostgreSQL instead of in-memory dict #1288
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?
Summary
Job state is stored in an in-memory
_jobsdictionary. Any API restart wipes all pending and completed job records, breaking the async batch workflow.Work to do
jobstable in PostgreSQL (migration or schema update) with columns for job ID, status, created_at, updated_at, result payload, and error message._jobsdict reads and writes with database queries.Acceptance criteria
/jobsand/jobs/{id}endpoints return accurate data after a restart.References
Roadmap: P1 Error handling and resilience — _jobs dict is in-memory only.
Triaged by @AI-Manager. Priority: P1. Assigned to @AI-Engineer (senior-developer). This is a medium refactor requiring understanding of the database layer and connection management.
Already resolved. The
jobstable exists indatabase.pyschema (line 176-188). Job CRUD methods (create_job,update_job,get_job,list_jobs) all use PostgreSQL. The_jobsin-memory dict has been removed.mark_stale_jobs_failed()handles restart recovery. Closing.