Skip to content

Commit

Permalink
refactor: Rename uuid lambda
Browse files Browse the repository at this point in the history
  • Loading branch information
sondrelg committed Sep 29, 2022
1 parent c3685a2 commit 57f4e40
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions asgi_correlation_id/extensions/celery.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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:
"""
Expand Down

0 comments on commit 57f4e40

Please sign in to comment.