mirror of https://github.com/pelias/api.git
Peter Johnson
10 years ago
3 changed files with 1 additions and 22 deletions
@ -1,19 +0,0 @@
|
||||
|
||||
// middleware which blocks requests when the eventloop is too busy
|
||||
var toobusy = require('toobusy'); |
||||
|
||||
function middleware(req, res, next){ |
||||
if( toobusy() ){ |
||||
res.status(503); // Service Unavailable
|
||||
return next('Server Overwhelmed'); |
||||
} |
||||
return next(); |
||||
} |
||||
|
||||
// calling .shutdown allows your process to exit normally
|
||||
process.on('SIGINT', function() { |
||||
toobusy.shutdown(); |
||||
process.exit(); |
||||
}); |
||||
|
||||
module.exports = middleware; |
Loading…
Reference in new issue