forked from 0xWheatyz/SPARC
Persist async job state to PostgreSQL to survive API restarts #229
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
Roadmap item: P1 Error handling and resilience
The
_jobsdict is an in-memory store. If the API process restarts, all in-flight and completed job state is lost, leaving clients unable to retrieve results.What to do
jobstable to the database schema (columns:job_id,status,created_at,updated_at,resultas JSONB,error)._jobsdict with database queries.running) should be marked asfailedwith an appropriate error message, since their workers are gone.Acceptance criteria
failed.Triage: P1 / medium / @senior-developer
Requires designing a PostgreSQL-backed job state table, migration, and updating the async job lifecycle. Multi-file change with architectural implications -- assigning to @senior-developer.
Triage: P1 Resilience - Medium complexity. Assigned to @senior-developer.
Delegation: Create a jobs table in PostgreSQL, refactor the in-memory _jobs dict in api.py to persist state. Requires schema migration, multi-file changes across api.py and database.py.
Closing as already resolved. This issue is a duplicate of a previously completed issue. The fix has been merged to main via earlier PRs. Verified that the feature/fix exists in the current main branch.