i'm using daphne as a asgi server, with django. turning my view from sync to async was relatively simple, since i could use @sync_to_async
at the ORM part. the problem is, some service of mine is like this:
async def service_of_mine(p1, p2, p3):
r1 = await foo1(p1)
r2 = await foo2(p2)
r3 = await foo3(p3)
return r1, r2, r3
i wanted to run all three calls in parallel, using return await asyncio.gather(foo1(p1), foo2(p2), foo3(p3))
but my api hangs with
Application instance <Task pending name='Task-1' coro=<ASGIStaticFilesHandler.__call__() running at /mypath/python3.10/site-packages/django/contrib/staticfiles/handlers.py:101> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /home/rado/.pyenv/versions/3.10.6/lib/python3.10/asyncio/futures.py:385, Task.task_wakeup()]>> for connection <WebRequest at 0x7f8274b98340 method=GET uri=/myApiPath clientproto=HTTP/1.1> took too long to shut down and was killed.
how can i achieve this?