-
-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Subscribe doesn't await the execution results #10
Comments
I don't know... that doesn't appear to be the problem. Let me give you the symptom: async def subscribe_count_seconds(
root: None, info: GraphQLResolveInfo, upTo: int
) -> typing.AsyncIterator[typing.Dict[str, int]]:
for i in range(upTo):
yield {"countSeconds": i}
await asyncio.sleep(1)
async def resolve_count_seconds( # does not get awaited
root: int, info: GraphQLResolveInfo, upTo: int
) -> str:
userid = await authorized_userid(info.context.request)
return f"you are {userid} and its been {root} seconds" |
Can you post a full test case showing what you do and what you expect to happen? |
Sure. I created a pretty robust test case that demonstrates how I'd expect it to work. https://gist.github.com/dfee/02264e4e0ea8f6f38ffbeb5e03356473 I have tests for all of it, and it's kinda the basis of some code I'm writing right now. Anyway, if you look at (and follow) line 371 ( |
Sorry for coming back to you only now, @dfee. I like your large test case - can I add it to the test suite? I've already added a unit test to I also noticed that GraphQL.js has the same issue, so I need to confer with them whether this should be backported. |
@Cito of course you can include it. Also, very interesting regarding GraphQL.js's compatibility. I'll follow up later on whether the patch works. |
execute
returns aMaybeAwaitable
butsubscribe
doesn't await it if it does.https://github.com/graphql-python/graphql-core-next/blob/3de6454304422b3cd832cb1bb075be202e26616c/graphql/subscription/subscribe.py#L67-L87
The text was updated successfully, but these errors were encountered: