Refactor code to remove async move closure which may result in double boxing.
This commit is contained in:
parent
2682ee1418
commit
213cb8de1a
1 changed files with 19 additions and 21 deletions
|
@ -258,9 +258,6 @@ 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;
|
||||
|
@ -270,7 +267,6 @@ where
|
|||
Ok(v) => Some(v),
|
||||
Err(e) => {
|
||||
sub_exec.push_error_at(e, pos);
|
||||
|
||||
if is_non_null {
|
||||
None
|
||||
} else {
|
||||
|
@ -278,11 +274,13 @@ where
|
|||
}
|
||||
}
|
||||
};
|
||||
AsyncValue::Field(AsyncField {
|
||||
|
||||
async_values.push_back(AsyncValueFuture::Field(future::ready(AsyncValue::Field(
|
||||
AsyncField {
|
||||
name: response_name,
|
||||
value,
|
||||
})
|
||||
}));
|
||||
},
|
||||
))));
|
||||
}
|
||||
|
||||
Selection::FragmentSpread(Spanning {
|
||||
|
|
Loading…
Add table
Reference in a new issue