5

I am using request-promise library and trying to set the timeout as milliseconds as per their documentation. I have few requests on the server side that take more than a minute to response, no matter what value I set for timeout, the request always times out after a minute. What is the correct way to set read timeout in request?

My request

rp({
  uri: "http://something.com/long_running_request",
  timeout: 180000
})
hong4rc
  • 3,999
  • 4
  • 21
  • 40
Prasanna
  • 3,703
  • 9
  • 46
  • 74
  • 1
    There are two timeouts, one for the whope request (which you set) and another timeout nodejs will throw if the server does not respond early. So this is actually a server error as the server should at least answer with an empty package when the data comes in. – Jonas Wilms Jul 09 '18 at 06:22
  • `Note that if the underlying TCP connection cannot be established, the OS-wide TCP connection timeout will overrule the timeout option` from the docs – Jonas Wilms Jul 09 '18 at 06:26

0 Answers0