-
Notifications
You must be signed in to change notification settings - Fork 425
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -258,31 +258,29 @@ where | |
let is_non_null = meta_field.field_type.is_non_null(); | ||
|
||
let response_name = response_name.to_string(); | ||
async_values.push_back(AsyncValueFuture::Field(async move { | ||
// TODO: implement custom future type instead of | ||
// two-level boxing. | ||
let res = instance | ||
.resolve_field_async(info, f.name.item, &args, &sub_exec) | ||
.await; | ||
|
||
let value = match res { | ||
Ok(Value::Null) if is_non_null => None, | ||
Ok(v) => Some(v), | ||
Err(e) => { | ||
sub_exec.push_error_at(e, pos); | ||
|
||
if is_non_null { | ||
None | ||
} else { | ||
Some(Value::null()) | ||
} | ||
let res = instance | ||
.resolve_field_async(info, f.name.item, &args, &sub_exec) | ||
.await; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like this |
||
|
||
let value = match res { | ||
Ok(Value::Null) if is_non_null => None, | ||
Ok(v) => Some(v), | ||
Err(e) => { | ||
sub_exec.push_error_at(e, pos); | ||
if is_non_null { | ||
None | ||
} else { | ||
Some(Value::null()) | ||
} | ||
}; | ||
AsyncValue::Field(AsyncField { | ||
} | ||
}; | ||
|
||
async_values.push_back(AsyncValueFuture::Field(future::ready(AsyncValue::Field( | ||
AsyncField { | ||
name: response_name, | ||
value, | ||
}) | ||
})); | ||
}, | ||
)))); | ||
} | ||
|
||
Selection::FragmentSpread(Spanning { | ||
|
There was a problem hiding this comment.
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.