question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Powerful timeouts

See original GitHub issue

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:

  • 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:closed
  • Created 7 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
focusauruscommented, Nov 23, 2016

👎 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).

0reactions
kornelskicommented, Apr 29, 2018

The MVP of response timeout seems to work well enough, so I’ll leave it at that.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found