Refactor blocklist import registration to async startup flow

This commit is contained in:
2026-04-11 20:07:00 +02:00
parent 952469e667
commit 9cba5a9fcb
4 changed files with 13 additions and 72 deletions

View File

@@ -69,6 +69,7 @@ Reference: `Docs/Refactoring.md` for full analysis of each issue.
- Issue: `blocklist_import.register` uses `asyncio.get_event_loop().run_until_complete` then falls back to `asyncio.ensure_future`, which is fragile and can fail if the application is already running inside an event loop.
- Propose: Refactor blocklist job registration to use a pure async bootstrap flow invoked from the lifespan handler, or resolve schedule configuration before starting the scheduler instead of forcing synchronous loop execution.
- Test: Add tests validating blocklist job registration in both non-running and running event loop contexts, and verify the registration path does not raise loop state errors.
- Status: completed
10. Standardize async offloading and thread-backed sync work behind a shared executor abstraction
- Goal: Remove scattered `asyncio.get_event_loop().run_in_executor` / `asyncio.ensure_future` patterns and give the backend a single, consistent way to run blocking file, CPU-bound, or compatibility work.