You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to fetch data via http but the nested call hangs - this can be replicated by using asyncio.sleep - I'm guessing it might have to do with graphene? or core? (or my lack of python experience - being a node dev I might have the wrong mindset)
Replication: comment out asyncio.sleep in fakeFetch to see the difference
fromflaskimportFlaskfromflask_graphqlimportGraphQLViewfromgraphql.execution.executors.asyncioimportAsyncioExecutorimportgrapheneimportasyncioimportsysapp=Flask(__name__)
defLog(message):
print(f"LOG: {message}", file=sys.stderr)
asyncdeffakeFetch():
Log('Wait a sec...')
awaitasyncio.sleep(1) # Comment this out and things workreturn'Async World'classBars(graphene.ObjectType):
bar=graphene.String()
asyncdefresolve_bar(self, args, context, info):
awaitfakeFetch()
return'Bar'classFoo(graphene.ObjectType):
bars=graphene.Field(Bars)
asyncdefresolve_bars(self, args, context, info):
awaitfakeFetch()
returnBars()
classQuery(graphene.ObjectType):
foo=graphene.Field(Foo)
defresolve_foo(self, args, context, info):
returnFoo()
schema=graphene.Schema(query=Query)
app.add_url_rule('/graphql', view_func=GraphQLView.as_view('graphql', schema=schema, graphiql=True, executor=AsyncioExecutor() ))
if__name__=="__main__":
app.run()
Using python 3.6, linux+mac
I'm trying to fetch data via http but the nested call hangs - this can be replicated by using
asyncio.sleep
- I'm guessing it might have to do with graphene? or core?(or my lack of python experience - being a node dev I might have the wrong mindset)
Replication: comment out
asyncio.sleep
infakeFetch
to see the differenceQuery:
requirements.txt
The text was updated successfully, but these errors were encountered: