You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd love to set a timeout on a per-request basis that overrides the timeout in the config. That way, individual requests can have a default timeout, while known long-running requests can disable the timeout.
The text was updated successfully, but these errors were encountered:
This is not a perfect answer, but using something like futures-time (blog) could perhaps do what you want it to:
use futures_time::prelude::*;use futures_time::time::Duration;let res = surf::get("api.example.com").timeout(Duration::from_secs(2))// provided by futures-time.await??;// the first `?` is surf, the second `?` is futures-time
It only allows defining timeouts shorter than the default; if they're longer the default will run first. So it may not fully suit your use case. But it might be a good way to get things working in the shorter-term without needing to modify surf directly.
There is probably a bigger question here too about what the right ways of structuring timeout hierarchies are, and for example a non-async version of surf should reason about timeouts (if at all). Buy maybe it's simply enough to say: "if you have an arbitrary operation you want to be able to time-out, you should call the timeout method on the future". I'm not sure heh.
I'd love to set a timeout on a per-request basis that overrides the timeout in the config. That way, individual requests can have a default timeout, while known long-running requests can disable the timeout.
The text was updated successfully, but these errors were encountered: