Skip to content

Commit

Permalink
Merge pull request #6 from taskiq-python/feature/app-runner-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
s3rius authored Nov 30, 2023
2 parents a25df7d + cad3a51 commit 87387d1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions taskiq_aiohttp/initializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,14 @@ async def startup(state: TaskiqState) -> None:

app = import_object(app_path)

if not isinstance(app, web.Application):
if inspect.iscoroutinefunction(app):
app = await app()
elif inspect.isfunction(app):
app = app()

if inspect.iscoroutine(app):
app = await app
if isinstance(app, web.AppRunner):
app = app.app

if not isinstance(app, web.Application):
raise ValueError(f"{app_path} is not an AioHTTP application.")

Expand Down

0 comments on commit 87387d1

Please sign in to comment.