David Shor
David Shor

Reputation: 37

Setting long timeout for http request via nodejs angular4 or express

I currently have a request which is made from an angular 4 app(which uses electron[which uses chromium]) to a bottleneck(nodejs/express) server. The server takes about 10 minutes to process the request. The default timeout which I'm getting is 120 seconds. I tried to use setting the timeout on the server using

App.use(timeout("1000s")

In the client side I have used

options = {
url,
method: GET
timeout : 600 * 1000} 
let req = http.request(options, () => {})
req.end()

I have also tried to give the specific route timeout. Each time the request hits 120 seconds the socket dies and I get a "socket timeout"

I have read many posts with the same questions but I didn't get any concrete answers. Is it possible to do a request with a long/no timeout using the tools above? Do I need to download a new library which handles long timeouts?

Any help would be greatly appriciated.

Upvotes: 0

Views: 396

Answers (1)

David Shor
David Shor

Reputation: 37

So after browsing through the internet I have discovered that there is no possible way to increase Chrome's timeout time. My solution to this problem was to open the request and return a default answer(something like "started") then pinging the server to find out it's status.

There is another possible solution which will be to put a route in the client(I'm using electron and node modules in the client side so it is possible) and then let the server ping back to the client with the status of the query. Writing this down so other people will have some possible patches. Will update if I'll find anything better.

Upvotes: 1

Related Questions