Skip to content

Commit

Permalink
send task_received signal before receive log
Browse files Browse the repository at this point in the history
  • Loading branch information
Niccolum committed Dec 6, 2023
1 parent 3617ee8 commit f3fad4e
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions celery/worker/strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,17 +148,7 @@ def task_message_handler(message, body, ack, reject, callbacks,
eventer=eventer, task=task, connection_errors=connection_errors,
body=body, headers=headers, decoded=decoded, utc=utc,
)
if _does_info:
# Similar to `app.trace.info()`, we pass the formatting args as the
# `extra` kwarg for custom log handlers
context = {
'id': req.id,
'name': req.name,
'args': req.argsrepr,
'kwargs': req.kwargsrepr,
'eta': req.eta,
}
info(_app_trace.LOG_RECEIVED, context, extra={'data': context})

if (req.expires or req.id in revoked_tasks) and req.revoked():
return

Expand All @@ -175,6 +165,18 @@ def task_message_handler(message, body, ack, reject, callbacks,
expires=req.expires and req.expires.isoformat(),
)

if _does_info:
# Similar to `app.trace.info()`, we pass the formatting args as the
# `extra` kwarg for custom log handlers
context = {
'id': req.id,
'name': req.name,
'args': req.argsrepr,
'kwargs': req.kwargsrepr,
'eta': req.eta,
}
info(_app_trace.LOG_RECEIVED, context, extra={'data': context})

bucket = None
eta = None
if req.eta:
Expand Down

0 comments on commit f3fad4e

Please sign in to comment.