Skip to content

Commit 87387d1

Browse files
authored
Merge pull request #6 from taskiq-python/feature/app-runner-fix
2 parents a25df7d + cad3a51 commit 87387d1

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

taskiq_aiohttp/initializer.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,14 @@ async def startup(state: TaskiqState) -> None:
9696

9797
app = import_object(app_path)
9898

99-
if not isinstance(app, web.Application):
99+
if inspect.iscoroutinefunction(app):
100+
app = await app()
101+
elif inspect.isfunction(app):
100102
app = app()
101103

102-
if inspect.iscoroutine(app):
103-
app = await app
104+
if isinstance(app, web.AppRunner):
105+
app = app.app
106+
104107
if not isinstance(app, web.Application):
105108
raise ValueError(f"{app_path} is not an AioHTTP application.")
106109

0 commit comments

Comments
 (0)