Skip to content

Commit

Permalink
load reqlimit bydefault
Browse files Browse the repository at this point in the history
  • Loading branch information
hefangshi committed Aug 25, 2016
1 parent 9af53a1 commit c8019d2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions plugins/http/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ function core(app, conf){

var defaultConf = {
middleware: [
'reqlimit',
'favicon',
'compression',
'static',
Expand Down
6 changes: 3 additions & 3 deletions plugins/reqlimit/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function initEventLoop(conf) {
return eventloop;
}

module.exports.reqlimit = function (app, conf) {
module.exports.reqlimit = ['log', function (app, conf) {
var shouldLimit = conf.shouldLimit;
var onLimit = conf.onLimit;
var eventloop;
Expand Down Expand Up @@ -47,13 +47,13 @@ module.exports.reqlimit = function (app, conf) {
});
});
};
};
}];

module.exports.reqlimit.defaultConf = {
eventLoop: {
interval: 300
},
maxDelay: 300,
maxDelay: 1000,
shouldLimit: function (info, conf, cb) {
if (info.delay > conf.maxDelay) {
return cb && cb(null, true);
Expand Down

0 comments on commit c8019d2

Please sign in to comment.