Powerful timeouts
See original GitHub issueCurrently 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:
- DNS timeout
- TCP/IP connection timeout
- File upload
- Waiting for HTTP response headers
- Waiting for each chunk of HTTP response body
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?
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Timeouts: Simple, powerful and often neglected | by Michal ...
It has a connection timeout of 300 seconds (5 minutes). And the total request timeout is even 0, meaning it never times out....
Read more >10 Timeout Best Practices - CLIMB
By following these best practices, you can ensure that your application is responsive and reliable. 1. Set a timeout limit for all requests....
Read more >Powerful timeouts · Issue #1115 · ladjs/superagent - GitHub
This is suboptimal for large files and slow connections, because it doesn't distinguish between the server not responding at all, and the file ......
Read more >Tuesday Tips: 7 Ways To Make The Most Of Your Timeouts ...
Timeouts are valuable resources in ultimate, and using them is one of the best ways a coach, captain, or team leader can influence...
Read more >Timeouts, retries and backoff with jitter - AWS
A timeout or failure doesn't necessarily mean that side effects haven't happened. If doing the side effects multiple times is undesirable, a best...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
👎 for clever API interpretations and overloading. My first thought would be leave
.timeout(2000)
as an alias for the entire request completing including the full body, and introduce APIs like.resolveTimeout(500)
,.connectTimeout(1000)
,.headerTimeout(3000)
,.chunkTimeout(4000)
.The MVP of response timeout seems to work well enough, so I’ll leave it at that.