Irina Petrushenko
Irina Petrushenko

Reputation: 37

Is it possible to set infinite timeout in node.js request?

I am using 'request' node.js module (https://github.com/request/request) to send requests to another service. And sometimes it is needed to send request and wait for the response infinitely, because of the slowness of this service to which the request was sent.

It is possible to set 'timeout' property to the request and by this way you will override the default value for read and connection timeout:

timeout - Integer containing the number of milliseconds to wait for a server to send response headers (and start the response body) before aborting the request. Note that if the underlying TCP connection cannot be established, the OS-wide TCP connection timeout will overrule the timeout option (the default in Linux can be anywhere from 20-120 seconds).

But what value we can set to make this timeout infinite?

Upvotes: 3

Views: 4676

Answers (2)

jesusgn90
jesusgn90

Reputation: 569

All clients have their own timeout(chrome, Firefox,...) then you must to think that's it's not useful to set a infinite timeout, you must to re-think your problem that's not the good way man

Upvotes: 1

FreedomPride
FreedomPride

Reputation: 1102

Set the server.timeout property from 120,000 (default) to 0

Upvotes: 1

Related Questions