Fix server timeout

This commit is contained in:
Michael Jackson 2016-06-13 18:56:18 -07:00
parent b4ee49b9b3
commit 60f880ae9d
1 changed files with 9 additions and 5 deletions

View File

@ -116,14 +116,18 @@ export const startServer = (serverConfig) => {
? createServer(config)
: createDevServer(config)
let httpServer = server.listen(config.port, () => {
console.log('Server #%s listening on port %s, Ctrl+C to stop', config.id, config.port)
})
if (httpServer == null)
httpServer = server.listeningApp
// Max request timeout on Heroku is 30s, so set our
// timeout to 20s to make sure we don't hang.
// https://devcenter.heroku.com/articles/request-timeout
server.timeout = 20000
server.listen(config.port, () => {
console.log('Server #%s listening on port %s, Ctrl+C to stop', config.id, config.port)
})
if (httpServer)
httpServer.timeout = 20000
}
if (require.main === module)