forked from 0xWheatyz/SPARC
Persist async job state in PostgreSQL so job status survives API restarts #902
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
The
_jobsdictionary in the API is stored purely in memory. Any API process restart wipes all in-progress and completed job records, making async batch results unrecoverable by clients.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
jobstable.GET /jobs/{job_id}returns the correct status after a restart.Reference
ROADMAP.md — P1 Error handling and resilience — _jobs dict is in-memory only
Triage: RESOLVED
This issue has been fully implemented in the fork main branch.
Evidence:
database.pycreates ajobstable ininitialize_schema()(confirmed by grep).api.pyusesdb.list_jobs(),db.get_job(),db.create_job(),db.update_job()instead of an in-memory_jobsdict.mark_stale_jobs_failed).All acceptance criteria are met. Recommending closure.