diff --git a/app.js b/app.js index d499c283..047aa903 100644 --- a/app.js +++ b/app.js @@ -3,7 +3,6 @@ var app = require('express')(); /** ----------------------- middleware ----------------------- **/ -app.use( require('./middleware/toobusy') ); // should be first app.use( require('./middleware/headers') ); app.use( require('./middleware/cors') ); app.use( require('./middleware/jsonp') ); diff --git a/middleware/toobusy.js b/middleware/toobusy.js deleted file mode 100644 index bbe6784f..00000000 --- a/middleware/toobusy.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/package.json b/package.json index 41bde4b6..7a541a0b 100644 --- a/package.json +++ b/package.json @@ -39,8 +39,7 @@ "geopipes-elasticsearch-backend": "0.0.11", "pelias-suggester-pipeline": "2.0.2", "is-object": "^1.0.1", - "pelias-esclient": "0.0.25", - "toobusy": "^0.2.4" + "pelias-esclient": "0.0.25" }, "devDependencies": { "ciao": "^0.3.4",