Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upInvestigate use of futures/stream/async in Fetch #22813
Open
Labels
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A "fetch" currently looks like:
servo/components/net/http_loader.rs
Line 1146 in 007333e
Note that the network fetch already uses a Tokio runtime to obtain the response and then handle the response.
In all cases where either the network or cached response is "awaited", this DoneChannel is used to signal that the response is ready, or cancelled.
It appears to me that the thread spawned at 1 above could be replaced with a(or several) Future, or maybe Stream, and that the entire workflow could be modeled with it. The "done channel" could also be replaced with a task-aware
channel.This is probably a better solution to the problem of "one thread per fetch" noted here #22768