I have a simple node application which handles
. This request takes some time to compute and return a file.
Each time the request lasts more than 2 minutes, the connection is closed. I'm using Express 4.10.2 and node 0.10.32.
I read that http module has a default timeout of 2 minutes: <a href="http://contourline.wordpress.com/2011/03/30/preventing-server-timeout-in-node-js/" rel="nofollow">http://contourline.wordpress.com/2011/03/30/preventing-server-timeout-in-node-js/</a>
I tried to use:
But even if the connection is not closed after two minutes, when the server tried to send the file back, I got:
EDIT:
works fine! Thanks @mscdex
Code:
GET /foo
Each time the request lasts more than 2 minutes, the connection is closed. I'm using Express 4.10.2 and node 0.10.32.
I read that http module has a default timeout of 2 minutes: <a href="http://contourline.wordpress.com/2011/03/30/preventing-server-timeout-in-node-js/" rel="nofollow">http://contourline.wordpress.com/2011/03/30/preventing-server-timeout-in-node-js/</a>
I tried to use:
Code:
server.on('connection', function(socket) {
socket.setTimeout(5*60*1000); //5 minutes
});
But even if the connection is not closed after two minutes, when the server tried to send the file back, I got:
Code:
{ [Error: Request aborted] code: 'ECONNABORT' }
EDIT:
Code:
server.setTimeout(5*60*1000);