From 57f4e403e150c879ba701caf0502429c2e0a7ac7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sondre=20Lilleb=C3=B8=20Gundersen?= Date: Thu, 29 Sep 2022 11:54:25 +0800 Subject: [PATCH] refactor: Rename uuid lambda --- asgi_correlation_id/extensions/celery.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/asgi_correlation_id/extensions/celery.py b/asgi_correlation_id/extensions/celery.py index bdd443a..d0e6e85 100644 --- a/asgi_correlation_id/extensions/celery.py +++ b/asgi_correlation_id/extensions/celery.py @@ -8,12 +8,10 @@ if TYPE_CHECKING: from celery import Task -uuid_hex_generator_fn: Callable[[], str] = lambda: uuid4().hex +uuid_hex_generator: Callable[[], str] = lambda: uuid4().hex -def load_correlation_ids( - header_key: str = 'CORRELATION_ID', generator: Callable[[], str] = uuid_hex_generator_fn -) -> None: +def load_correlation_ids(header_key: str = 'CORRELATION_ID', generator: Callable[[], str] = uuid_hex_generator) -> None: """ Transfer correlation IDs from a HTTP request to a Celery worker, when spawned from a request. @@ -66,7 +64,7 @@ def cleanup(**kwargs: Any) -> None: def load_celery_current_and_parent_ids( header_key: str = 'CELERY_PARENT_ID', - generator: Callable[[], str] = uuid_hex_generator_fn, + generator: Callable[[], str] = uuid_hex_generator, use_internal_celery_task_id: bool = False, ) -> None: """