Skip to content

Commit

Permalink
fix: loop_wrapper decorators were returning coro task instead of func
Browse files Browse the repository at this point in the history
  • Loading branch information
timoniq committed Jul 12, 2024
1 parent d57de84 commit 5f742d4
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions telegrinder/tools/loop_wrapper/loop_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,11 @@ class Lifespan:
shutdown_tasks: list[CoroutineTask[typing.Any]] = dataclasses.field(default_factory=lambda: [])

def on_startup(self, task_or_func: Task) -> Task:
task_or_func = to_coroutine_task(task_or_func)
self.startup_tasks.append(task_or_func)
self.startup_tasks.append(to_coroutine_task(task_or_func))
return task_or_func

def on_shutdown(self, task_or_func: Task) -> Task:
task_or_func = to_coroutine_task(task_or_func)
self.shutdown_tasks.append(task_or_func)
self.shutdown_tasks.append(to_coroutine_task(task_or_func))
return task_or_func

def start(self, loop: asyncio.AbstractEventLoop) -> None:
Expand Down

0 comments on commit 5f742d4

Please sign in to comment.