Skip to content

Commit

Permalink
fix: apply contract event labels to task when appropriate
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeshultz committed Apr 24, 2024
1 parent 58f3064 commit 82fc7c8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion silverback/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,16 @@ def broker_task_decorator(

# Register user function as task handler with our broker
def add_taskiq_task(handler: Callable) -> AsyncTaskiqDecoratedTask:
labels = {"task_type": str(task_type)}

if container and isinstance(container, ContractEvent):
labels["contract_address"] = container.contract.address
labels["event_abi"] = container.abi

broker_task = self.broker.register_task(
handler,
task_name=handler.__name__,
task_type=str(task_type),
**labels,
)

self.tasks[task_type].append(TaskData(container=container, handler=broker_task))
Expand Down

0 comments on commit 82fc7c8

Please sign in to comment.