forked from 0xWheatyz/SPARC
Fix: persist job state in PostgreSQL so batch results survive API restarts #879
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 backend is in-memory only. All async batch job state is lost when the API process restarts, leaving users with no way to retrieve results.Roadmap reference: P1 Error handling and resilience
What to do
jobstable in PostgreSQL (id, status, created_at, updated_at, result_json, error)._jobsdict with database queries.failedorunknownif they were interrupted.Acceptance criteria
This issue has been resolved. The changes are already merged into main.
Jobs table created in PostgreSQL (database.py). Batch job state persisted via DB queries. Stale jobs marked as failed on startup.
Closing as completed.