Skip to content

Commit

Permalink
refactor: remove .task_name from message labels
Browse files Browse the repository at this point in the history
  • Loading branch information
fubuloubu committed Apr 9, 2024
1 parent 8798669 commit 2a7d62a
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions silverback/middlewares.py
Original file line number Diff line number Diff line change
Expand Up @@ -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", "<unknown>")

# NOTE: Don't compare `str` to `TaskType` using `is`
Expand Down

0 comments on commit 2a7d62a

Please sign in to comment.