...
|
...
|
@@ -29,6 +29,8 @@ module.exports = (limiter, policy) => { |
|
|
|
|
|
const key = `pc:limiter:${limiter.remoteIp}`;
|
|
|
|
|
|
let isNew = false;
|
|
|
|
|
|
res.on('render', function() {
|
|
|
let route = req.route ? req.route.path : '';
|
|
|
let appPath = req.app.mountpath;
|
...
|
...
|
@@ -44,7 +46,7 @@ module.exports = (limiter, policy) => { |
|
|
pageIncr = 5;
|
|
|
}
|
|
|
|
|
|
if (pageIncr > 0) {
|
|
|
if (pageIncr > 0 && !isNew) {
|
|
|
cache.incrAsync(key, pageIncr);
|
|
|
}
|
|
|
});
|
...
|
...
|
@@ -70,6 +72,7 @@ module.exports = (limiter, policy) => { |
|
|
}
|
|
|
} else {
|
|
|
cache.setAsync(key, 1, 60); // 设置key,1m失效
|
|
|
isNew = true;
|
|
|
return Promise.resolve(true);
|
|
|
}
|
|
|
});
|
...
|
...
|
|