No cover the worker init (tested manually) and make sonar happy

This commit is contained in:
Trenton H
2026-03-10 07:42:21 -07:00
parent 130a73ec71
commit d4b6075a2a
2 changed files with 10 additions and 5 deletions
+4 -3
View File
@@ -19,13 +19,14 @@ app.autodiscover_tasks()
@worker_process_init.connect
def on_worker_process_init(**kwargs) -> None:
"""Register built-in parsers eagerly in each Celery worker process.
def on_worker_process_init(**kwargs) -> None: # pragma: no cover
"""
Register built-in parsers eagerly in each Celery worker process.
This registers only the built-in parsers (no entrypoint discovery) so
that workers can begin consuming documents immediately. Entrypoint
discovery for third-party parsers is deferred to the first call of
``get_parser_registry()`` inside a task, keeping ``worker_process_init``
get_parser_registry() inside a task, keeping worker_process_init
well within its 4-second timeout budget.
"""
from paperless.parsers.registry import init_builtin_parsers
+6 -2
View File
@@ -69,7 +69,9 @@ def dummy_parser_cls() -> type:
*,
produce_archive: bool = True,
) -> None:
pass
"""
Required to exist, but doesn't need to do anything
"""
def get_text(self) -> str | None:
return None
@@ -105,7 +107,9 @@ def dummy_parser_cls() -> type:
return self
def __exit__(self, exc_type, exc_val, exc_tb) -> None:
pass
"""
Required to exist, but doesn't need to do anything
"""
return DummyParser