You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For some context on what we were trying to achieve;
We were building a custom Sentry Integration for TaskIq that would add tracing meta-data as labels to queued messages, to achieve this we patched AsyncKicker.kiq and Receiver.run_task methods to add tracing info to message labels which would track tasks from when there were submitted to when a worker picks up and processes the message.
The above test case fails because after the second task is submitted all other subsequent tasks will have a trcae_id of 22222.
Our current workaround is to use a custom task class which doesn't mutate the original task labels
classCustomTask(AsyncTaskiqDecoratedTask):
defkicker(self) ->AsyncKicker[_FuncParams, _ReturnType]:
""" This function returns kicker object. Kicker is a object that can modify kiq request before sending it. :return: AsyncKicker instance. """returnAsyncKicker(
task_name=self.task_name,
broker=self.broker,
labels=deepcopy(self.labels),
)
broker.decorator_class=CustomTask
The text was updated successfully, but these errors were encountered:
donc310
changed the title
AsyncTaskiqDecoratedTask().kicker().with_labels() mutates task labelsAsyncTaskiqDecoratedTask().kicker().with_labels() mutates task labels
Mar 1, 2024
You're completely right. If you want to become a contributor, you can create a PR that fixes it. I haven't experienced this problem yet, but I think it's a possible bug.
Thanks for noticing. If you don't want to create a PR, I can create a patch myself.
Hello and thank you very much for your work on this project.
I currently have an issue where tasks submitted with custom labels mutates the underlying decorated task instance
For some context on what we were trying to achieve;
We were building a custom Sentry Integration for TaskIq that would add tracing meta-data as labels to queued messages, to achieve this we patched
AsyncKicker.kiq
andReceiver.run_task
methods to add tracing info to message labels which would track tasks from when there were submitted to when a worker picks up and processes the message.The above test case fails because after the second task is submitted all other subsequent tasks will have a trcae_id of
22222
.Our current workaround is to use a custom task class which doesn't mutate the original task labels
The text was updated successfully, but these errors were encountered: