Browse Source

remove toobusy module

pull/72/head
Peter Johnson 10 years ago
parent
commit
8aed2a0c6f
  1. 1
      app.js
  2. 19
      middleware/toobusy.js
  3. 3
      package.json

1
app.js

@ -3,7 +3,6 @@ var app = require('express')();
/** ----------------------- middleware ----------------------- **/ /** ----------------------- middleware ----------------------- **/
app.use( require('./middleware/toobusy') ); // should be first
app.use( require('./middleware/headers') ); app.use( require('./middleware/headers') );
app.use( require('./middleware/cors') ); app.use( require('./middleware/cors') );
app.use( require('./middleware/jsonp') ); app.use( require('./middleware/jsonp') );

19
middleware/toobusy.js

@ -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;

3
package.json

@ -39,8 +39,7 @@
"geopipes-elasticsearch-backend": "0.0.11", "geopipes-elasticsearch-backend": "0.0.11",
"pelias-suggester-pipeline": "2.0.2", "pelias-suggester-pipeline": "2.0.2",
"is-object": "^1.0.1", "is-object": "^1.0.1",
"pelias-esclient": "0.0.25", "pelias-esclient": "0.0.25"
"toobusy": "^0.2.4"
}, },
"devDependencies": { "devDependencies": {
"ciao": "^0.3.4", "ciao": "^0.3.4",

Loading…
Cancel
Save