Authored by 周少峰

Merge branch 'hotfix/memcached-incr' into hotfix/submit

... ... @@ -29,7 +29,7 @@ module.exports = (limiter, policy) => {
const key = `pc:limiter:${limiter.remoteIp}`;
let isNew = false;
let isNew = true;
res.on('render', function() {
let route = req.route ? req.route.path : '';
... ... @@ -53,9 +53,8 @@ module.exports = (limiter, policy) => {
return cache.getAsync(key).then((result) => {
logger.debug('qps limiter: ' + key + '@' + result + ' max: ' + MAX_QPS);
if (result && _.isNumber(result)) {
isNew = false;
if (result === -1) {
return Promise.resolve(true);
}
... ... @@ -72,7 +71,6 @@ module.exports = (limiter, policy) => {
}
} else {
cache.setAsync(key, 1, 60); // 设置key,1m失效
isNew = true;
return Promise.resolve(true);
}
});
... ...