mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-06-03 12:19:45 +00:00
No cover the worker init (tested manually) and make sonar happy
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user