Refactor code to remove async move closure which may result in double…#1256
Open
jawang94 wants to merge 1 commit intographql-rust:masterfrom
Open
Refactor code to remove async move closure which may result in double…#1256jawang94 wants to merge 1 commit intographql-rust:masterfrom
jawang94 wants to merge 1 commit intographql-rust:masterfrom
Conversation
audunhalland
reviewed
May 6, 2024
| } | ||
| let res = instance | ||
| .resolve_field_async(info, f.name.item, &args, &sub_exec) | ||
| .await; |
Contributor
There was a problem hiding this comment.
It looks like this .await breaks concurrency. The await now happens directly within the for loop body, so the future will pause at this point before processing the next select. The intention of async_values is that the loop should produce all the futures synchronously up front, then after this loop there is another while loop at the bottom of the function which polls the FuturesOrdered so that all its contained futures may progress simultaneously.
audunhalland
reviewed
May 6, 2024
Comment on lines
-262
to
-263
| // TODO: implement custom future type instead of | ||
| // two-level boxing. |
Contributor
There was a problem hiding this comment.
I don't see any boxing at all.. AsyncValueFuture is generic so this comment looks outdated.
LegNeato
requested changes
Jul 11, 2024
Member
LegNeato
left a comment
There was a problem hiding this comment.
See the comments from @audunhalland
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #820
I did not detect any apparent double boxing issues here however I refactored the code to use the custom
AsyncValueFutureenum and eliminate the unnecessaryasync moveclosure. This is my first contribution here - allcargo tests passed however thetest.bookfailed with some strange error about thedataloadercrate which seems unrelated.P.S. I am new to rust and snooping around for real-world practice so please advise me if I've made mistakes or missed something! Thank you in advance and hope to contribute more in the future!