From 2a7d62a4e3cc5597ff5ed1f8a6c17dbf7541f547 Mon Sep 17 00:00:00 2001 From: fubuloubu <3859395+fubuloubu@users.noreply.github.com> Date: Tue, 9 Apr 2024 18:23:06 -0400 Subject: [PATCH] refactor: remove `.task_name` from message labels --- silverback/middlewares.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/silverback/middlewares.py b/silverback/middlewares.py index 27d7a73c..b9830c3f 100644 --- a/silverback/middlewares.py +++ b/silverback/middlewares.py @@ -49,16 +49,13 @@ def fix_dict(data: dict, recurse_count: int = 0) -> dict: return message def _create_label(self, message: TaskiqMessage) -> str: - if labels_str := ( - ",".join(f"{k}={v}" for k, v in message.labels.items() if k != "task_name") - ): + if labels_str := ",".join(f"{k}={v}" for k, v in message.labels.items()): return f"{message.task_name}[{labels_str}]" else: return message.task_name def pre_execute(self, message: TaskiqMessage) -> TaskiqMessage: - message.labels["task_name"] = message.task_name task_type = message.labels.pop("task_type", "") # NOTE: Don't compare `str` to `TaskType` using `is`