Remove dead task DB fast-path and update task tests

This commit is contained in:
2026-04-07 20:00:13 +02:00
parent 0a70e40d8b
commit e21f153946
9 changed files with 96 additions and 25 deletions

View File

@@ -20,7 +20,7 @@ Reference: `Docs/Refactoring.md` for full analysis of each issue.
- Fix: move service-dependent helpers into `app/services/` or extract shared logic into a new `app/helpers/` layer, keeping `app/utils/` purely independent.
- Expected outcome: lower coupling between utility and service layers, cleaner dependency direction, and better maintainability.
- Background task modules in `backend/app/tasks/` check `app.state.db` before opening a DB connection, but no code sets `app.state.db`. That means the fast-path branch is dead and the DB handling is misleading.
- Status: **done** — background task modules in `backend/app/tasks/` no longer rely on the dead `app.state.db` fast-path and now open/close dedicated task-local DB connections using `app.state.settings.database_path`.
- Fix: remove the unused `app.state.db` branch and always open/close a dedicated task-local connection, or intentionally add a shared DB connection to `app.state` and manage its lifecycle.
- Expected outcome: background jobs have predictable DB lifecycle, avoid hidden bugs from stale connection assumptions, and task code is simpler.