forked from 0xWheatyz/SPARC
Persist async job state in PostgreSQL instead of in-memory dict #944
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
Job state is currently stored in an in-memory
_jobsdict. Any API restart wipes all pending or completed job records, losing results that users have not yet retrieved.Task
jobstable in PostgreSQL (or reuse an existing migration mechanism) with columns forid,status,created_at,updated_at,result,error._jobswith database operations.Acceptance Criteria
GET /jobs/{id}returns correct status and results for jobs created before the restart.Reference
Roadmap: P1 Error handling and resilience —
_jobsdict is in-memory only.Triaged by repo manager. This issue has already been resolved in the current codebase.
database.pycontains ajobstable (line 177) with columns for id, status, created_at, updated_at, result, and error. Methodscreate_job()(line 513),update_job()(line 541),list_jobs()(line 596), andmark_stale_jobs_failed()(line 640) persist all job state in PostgreSQL. The in-memory_jobsdict has been fully replaced. Closing as already implemented.