-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
@defer
initial support
#2642
@defer
initial support
#2642
Conversation
Signed-off-by: Steve Coffman <steve@khanacademy.org>
Awesome, this is amazing. |
Yes, will do. Now that you two have fixed all the things that should be easy. |
Turns out not having |
I'm using this in production and finding some race condition bugs. The updated version is on my branch |
Thanks for your work on this @fiatjaf @StevenACoffman ! |
oh, I saw this comment and decided it was a good time for me to bring my new changes and add some tests to the defer feature, but it looks like @UnAfraid had already done that along with a few fixes, and had even written tests! Amazing. Thank you! |
@danielcondemarin I think https://github.com/fiatjaf/gqlgen-defer-demo/blob/master/gql_generated.go could be a good start, since it is very minimal and has defer stuff in it. I am not very familiar with how |
I think the idea is that I guess then you would have to allow resolvers to be declared on user code as returning After describing it like that it seems simple. The part that I'm not familiar at all with is how to make the code generator detect functions returning |
Yeah my understanding is only for list fields, client can specify how many items to receive on the first response back, then from that point the server can return one or more at a time. |
Hey, all. Any updates on |
@UnAfraid @fiatjaf PR with one extra commit
This implements
@defer
support according to https://github.com/graphql/graphql-wg/blob/66a80c7e7ff5d881a7de515eec991ca3150c829b/rfcs/DeferStream.mdThere are no tests and there may be some bugs yet, but I'm just opening this to ask if this change is desired and/or if the code quality is too bad to be considered -- before I put more time polishing it and writing tests.
(Don't look at the first commit, please, just look at the final result.)
There is a demo app at https://github.com/fiatjaf/gqlgen-defer-demo, you can try it live on https://defer.fiatjaf.com/debug/. Only the fields
availability
,here
andthere
are concurrent, so they're the only ones that can be deferred (the others will just return in the normal response regardless). Try the queryscreencast.mp4
I have: