Description
The #13 PR introduced executors into request processing for batched queries. It also broken support for use of AsyncioExecutor from within asyncio context.
When using AsyncioExecutor this line blocks forever:
The get()
method is called on Promise that must be await
ed in async context, here it will stay pending
forever.
Call to wait_until_finished()
on executor does not help because get_response
is not a coroutine and returns a Promise. Async Promises are not handled by wait_until_finished()
method of AsyncioExecutor (code). Even if it was, AsyncioExecutor.wait_until_finished()
cannot run from within asyncio context and would fail for any asyncio-based application like aiohttp server.
related issue: graphql-python/graphql-core#67
Fix to the above issue introduces a flag return_promise
which is just what we need to handle response in async context.
implementatio details:
graphql-python/graphql-core@b4758b1
graphql-python/graphql-core@895b324
graphql-python/graphql-core@cea224a
This fragment of graphql-core test show hows its intended to be used in asyncio context:
The return_promise
lets the main application handle waiting for executors to finish its task, so graphql-server-core should respect that.
I found this issue in my aiohttp application (using graphql-python/aiohttp-graphql), all queries would block forever. I had to restrict this package version to <=1.1.1