Skip to content
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

Refactor code to remove async move closure which may result in double… #1256

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jawang94
Copy link

@jawang94 jawang94 commented May 4, 2024

Closes #820

I did not detect any apparent double boxing issues here however I refactored the code to use the custom AsyncValueFuture enum and eliminate the unnecessary async move closure. This is my first contribution here - all cargo tests passed however the test.book failed with some strange error about the dataloader crate 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!

}
let res = instance
.resolve_field_async(info, f.name.item, &args, &sub_exec)
.await;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines -262 to -263
// TODO: implement custom future type instead of
// two-level boxing.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any boxing at all.. AsyncValueFuture is generic so this comment looks outdated.

Copy link
Member

@LegNeato LegNeato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the comments from @audunhalland

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create a custom future to prevent double boxing
3 participants