Skip to content

Commit

Permalink
Added web.AppRunner support.
Browse files Browse the repository at this point in the history
Signed-off-by: Pavel Kirilin <[email protected]>
  • Loading branch information
s3rius committed Nov 30, 2023
1 parent a25df7d commit cad3a51
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 cad3a51

Please sign in to comment.