request restart on unhandled exceptions to avoid memory leak

This commit is contained in:
Brian Gough 2014-12-18 16:55:11 +00:00
parent 72ad81887a
commit c2e50c619d

View file

@ -37,6 +37,8 @@ app.use (req, res, next) ->
requestDomain.add req
requestDomain.add res
requestDomain.on "error", (err)->
# request a shutdown to prevent memory leaks
appIsOk = false
setTimeout(->
if !res.headerSent
res.send(500)