forked from 0xWheatyz/SPARC
Persist async batch job state to PostgreSQL instead of in-memory dict #1379
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
Roadmap item: P1 Error handling and resilience — _jobs dict is in-memory only
The
_jobsdictionary that tracks async batch job status lives only in memory. Any API restart (deployment, crash, OOM kill) loses all in-progress and completed job records. Users get 404 errors when polling for results.Task
jobstable in PostgreSQL (or reuse an existing migration mechanism) with columns:job_id,status,created_at,updated_at,result(JSONB),error._jobswith database operations (create, update, fetch by id).Acceptance Criteria
_jobsin-memory dict is fully removed from the codebase.jobstable is included in the PR.Reference
See ROADMAP.md § P1 Error handling and resilience.
Resolved by PR #34 (merged). Async batch job state is now persisted to PostgreSQL via
db.create_job(),db.update_job(),db.get_job(), anddb.list_jobs(). Stale jobs are marked failed on startup.