This question might be closely related to this GitHub issue.
I have a GraphQL server written in Rust using Juniper. This server needs to perform some HTTP requests in order to build and send back the data required by the clients.
Some fields may need up to ~15 HTTP requests, at most (essentially collections). To run theses requests sequentially might take time, and I was considering using Tokio + Futures to run them in parallel. It seems to be technically doable, but so far I have no clue on how to actually implement such a solution, and couldn't find any example using Juniper and Tokio, until I found the GitHub issue mentioned earlier...
Something like the following:
graphql_object(Whatever: MyContext |&self| {
field parallel_requests(&executor) -> ??? {
multiple_parallel_http_requests()
}
}
Where ???
is FieldResult<Vec<AnyResource>>
(?). And if so, how?