Closed
Description
Hello!
How can I use AsyncExecutor with graphene-django?
I try this setup:
# types.py
class Source(graphene.ObjectType):
value = graphene.String()
# queries.py
class SourcesQuery(graphene.ObjectType):
sources = graphene.List(
of_type=Source
)
async def resolve_sources(self, info):
await asyncio.sleep(0.0001)
return [Source(value='foo'), Source(value='bar')]
# backend.py
class CustomBackend(GraphQLCoreBackend):
def __init__(self, *args, **kwargs):
self.execute_params = {
"executor": AsyncioExecutor(),
"return_promise": False,
}
# urls.py
path("graphql", GraphQLView.as_view(
backend=CustomBackend(),
schema=graphene.Schema(query=SourcesQuery),
)),
But this didn't work.
What is wrong?
Metadata
Metadata
Assignees
Labels
No labels