Skip to content

Commit

Permalink
fix: pop throws exception on non-existant key
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeshultz committed Apr 24, 2024
1 parent 87672ac commit 58f3064
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion silverback/middlewares.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def _create_label(self, message: TaskiqMessage) -> str:
return message.task_name

def pre_execute(self, message: TaskiqMessage) -> TaskiqMessage:
if not (task_type := message.labels.pop("task_type")):
if "task_type" not in message.labels or not (task_type := message.labels.pop("task_type")):
return message # Not a silverback task

try:
Expand Down

0 comments on commit 58f3064

Please sign in to comment.