-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Powerful timeouts #1115
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
Comments
👎 for clever API interpretations and overloading. My first thought would be leave |
By overloading, do you mean |
Also, should we have any defaults? |
Yes, overloading meaning a single API function call that has multiple meanings or behaviors depending on arguments provided. I think in general that's an antipattern and having distinct API functions that do 1 clear thing is preferable, even if it means the API surface is bigger (it's just being honest about the actual API surface). I don't mind I think we should have no defaults and do what the runtimes/node/oses do by default. |
The MVP of response timeout seems to work well enough, so I'll leave it at that. |
Currently there's a single
timeout
option that sets a deadline for the entire request to complete.This is suboptimal for large files and slow connections, because it doesn't distinguish between the server not responding at all, and the file downloading reliably, but slowly.
In reality there are multiple stages of the request that can time out:
I'm thinking of hooking into more of these steps to allow having shorter timeouts as appropriate, e.g. DNS and TCP/IP connection never take more than a few seconds, even if the whole request needs minutes to download.
What should be the API for this? Should we try to interpret existing
.timeout(2000)
API in some clever way?The text was updated successfully, but these errors were encountered: