Skip to content

Commit 8d4f5e2

Browse files
authored
fix: taskiq tries to set an illegal attribute of our system task methods (#223)
1 parent ec0a9b5 commit 8d4f5e2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

silverback/main.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import inspect
33
from collections import defaultdict
44
from datetime import timedelta
5-
from functools import wraps
5+
from functools import update_wrapper, wraps
66
from typing import Any, Awaitable, Callable
77

88
from ape.api.networks import LOCAL_NETWORK_NAME
@@ -182,7 +182,9 @@ def __register_system_task(
182182
assert str(task_type).startswith("system:"), "Can only add system tasks"
183183
# NOTE: This has to be registered with the broker in the worker
184184
return self.broker.register_task(
185-
task_handler,
185+
# NOTE: We need this as `.register_task` tries to update `.__name__` of `task_handler`,
186+
# but it is a method not a function (`update_wrapper` transforms it into one)
187+
update_wrapper(lambda *args, **kwargs: task_handler(*args, **kwargs), task_handler),
186188
# NOTE: Name makes it impossible to conflict with user's handler fn names
187189
task_name=str(task_type),
188190
task_type=str(task_type),

0 commit comments

Comments
 (0)