fix: initialize document processors in the ingest worker (PR #836 round-5)
🟡 The `worker` command never called initialize_document_processors(), so a worker pod with ENABLE_UNSTRUCTURED/TESSERACT/CUSTOM configured silently ran PyMuPDF-only (only the import-time-registered processor). The always-on API pod registers them in its lifespan; the worker has its own startup path, so call initialize_document_processors() there too (before run_worker_async). 🟢 Drop the unused get_database_url monkeypatch in the Postgres integration fixture (build_app_for_url passes the URL explicitly; only the ssl lookup needs pinning). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
704a537847
commit
5affbbcaa6
@@ -328,6 +328,14 @@ def worker(concurrency: int | None):
|
||||
workers = concurrency or settings.vector_sync_processor_workers
|
||||
app = get_procrastinate_app()
|
||||
|
||||
# Register the configured document processors (Unstructured / Tesseract /
|
||||
# custom HTTP) in the worker process. The always-on API pod does this in its
|
||||
# lifespan; the worker has its own startup path, so without this the worker
|
||||
# would silently fall back to the import-time-registered PyMuPDF only.
|
||||
from nextcloud_mcp_server.app import initialize_document_processors # noqa: PLC0415
|
||||
|
||||
initialize_document_processors()
|
||||
|
||||
async def _run() -> None:
|
||||
# Open the connector pool once and reuse it for both the defensive
|
||||
# schema apply (the always-on API pod is the authoritative applier) and
|
||||
|
||||
@@ -78,8 +78,8 @@ async def fresh_app(postgres_url: str, monkeypatch: pytest.MonkeyPatch):
|
||||
finally:
|
||||
await engine.dispose()
|
||||
|
||||
# get_procrastinate_conninfo derives ssl from settings; point it at the URL.
|
||||
monkeypatch.setattr(config_module, "get_database_url", lambda: postgres_url)
|
||||
# build_app_for_url passes the URL explicitly to get_procrastinate_conninfo,
|
||||
# so only the ssl lookup (which reads settings) needs pinning here.
|
||||
monkeypatch.setattr(config_module, "get_database_ssl", lambda: None)
|
||||
|
||||
app = build_app_for_url(postgres_url)
|
||||
|
||||
Reference in New Issue
Block a user