Authored by 郝肖肖

'limiter-rm-cache'

... ... @@ -3,6 +3,7 @@
const _ = require('lodash');
const logger = global.yoho.logger;
const Geetest = require('geetest');
const config = global.yoho.config;
const co = Promise.coroutine;
const cache = global.yoho.cache.master;
const captcha = new Geetest({
... ... @@ -65,13 +66,13 @@ exports.submit = (req, res) => {
remoteIp = arr[0];
}
let key = `pc:limiter:${remoteIp}`;
let key10m = `pc:limiter:10m:${remoteIp}`;
let operations = [cache.delAsync(`${config.app}:limiter:${remoteIp}`)];
yield Promise.all([
cache.delAsync(key),
cache.delAsync(key10m)
]);
_.forEach(config.REQUEST_LIMIT, (val, key) => {
operations.push(cache.delAsync(`${config.app}:limiter:${key}:max:${remoteIp}`));
});
yield Promise.all(operations);
return res.json({
code: 200
... ...