node.js - Express 4.x closes connections after 2 minutes -
i have simple node application handles get /foo
. request takes time compute , return file. each time request lasts more 2 minutes, connection closed. i'm using express 4.10.2 , node 0.10.32.
i read http module has default timeout of 2 minutes: http://contourline.wordpress.com/2011/03/30/preventing-server-timeout-in-node-js/
i tried use:
server.on('connection', function(socket) { socket.settimeout(5*60*1000); //5 minutes });
but if connection not closed after 2 minutes, when server tried send file back, got:
{ [error: request aborted] code: 'econnabort' }
edit:
server.settimeout(5*60*1000);
works fine! @mscdex
server.settimeout()
method sets http connection timeout connections.
Comments
Post a Comment