root: fix name conflict in threadlocal
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
86a9271f75
commit
26b35c9b7b
|
@ -46,7 +46,7 @@ def after_task_publish_hook(sender=None, headers=None, body=None, **kwargs):
|
||||||
def task_prerun_hook(task_id, task, *args, **kwargs):
|
def task_prerun_hook(task_id, task, *args, **kwargs):
|
||||||
"""Log task_id on worker"""
|
"""Log task_id on worker"""
|
||||||
request_id = "task-" + uuid4().hex[5:]
|
request_id = "task-" + uuid4().hex[5:]
|
||||||
LOCAL.authentik = {
|
LOCAL.authentik_task = {
|
||||||
"request_id": request_id,
|
"request_id": request_id,
|
||||||
}
|
}
|
||||||
LOGGER.debug("Task started", task_id=task_id, task_name=task.__name__)
|
LOGGER.debug("Task started", task_id=task_id, task_name=task.__name__)
|
||||||
|
@ -57,8 +57,10 @@ def task_prerun_hook(task_id, task, *args, **kwargs):
|
||||||
def task_postrun_hook(task_id, task, *args, retval=None, state=None, **kwargs):
|
def task_postrun_hook(task_id, task, *args, retval=None, state=None, **kwargs):
|
||||||
"""Log task_id on worker"""
|
"""Log task_id on worker"""
|
||||||
LOGGER.debug("Task finished", task_id=task_id, task_name=task.__name__, state=state)
|
LOGGER.debug("Task finished", task_id=task_id, task_name=task.__name__, state=state)
|
||||||
for key in list(LOCAL.authentik.keys()):
|
if not hasattr(LOCAL, "authentik_task"):
|
||||||
del LOCAL.authentik[key]
|
return
|
||||||
|
for key in list(LOCAL.authentik_task.keys()):
|
||||||
|
del LOCAL.authentik_task[key]
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=unused-argument
|
# pylint: disable=unused-argument
|
||||||
|
|
Reference in New Issue