File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,6 +18,14 @@ const server = app.listen(port, () => {
1818 console . log ( `Listening on ${ port } ` )
1919} )
2020
21+ // The number of seconds an idle Keep-Alive connection is kept open. This should be greater than the Heroku Router's
22+ // Keep-Alive idle timeout of 90 seconds:
23+ // - to ensure that the closing of idle connections is always initiated by the router and not the Node.js server
24+ // - to prevent a race condition if the router sends a request to the app just as Node.js is closing the connection
25+ // https://devcenter.heroku.com/articles/http-routing#keepalives
26+ // https://nodejs.org/api/http.html#serverkeepalivetimeout
27+ server . keepAliveTimeout = 95 * 1000
28+
2129process . on ( 'SIGTERM' , async ( ) => {
2230 console . log ( 'SIGTERM signal received: gracefully shutting down' )
2331 if ( server ) {
You can’t perform that action at this time.
0 commit comments