Friday, May 31, 2019

NodeJS HTTP Server Timeout

In Nodejs an HTTP server created by http.createServer() has a default timout of 2 minutes (12000ms). I have an HTML client that calls the server through a GET request and the server starts a batch file that takes more than 5 minutes to finish. After two minutes, the server hits the timout and does some sort of restart (I guess), calls the batch file again and this continues ad infinitum, none of the client GET requests getting a return!

Solution: server.setTimeout(0); //disables timeout

No comments: