redis keys in easier way

This commit is contained in:
Simon Martín
2018-02-20 17:19:50 +01:00
parent 6564ed69d8
commit faab174a79
3 changed files with 13 additions and 26 deletions
+2 -2
View File
@@ -5,7 +5,7 @@ const cartodbRedis = require('cartodb-redis');
const {
rateLimitMiddleware,
RATE_LIMIT_ENDPOINTS_GROUPS,
RATE_LIMIT_STORE_KEY
getStoreKey
} = require('../../../lib/cartodb/middleware/rate-limit');
let redisClient;
@@ -19,7 +19,7 @@ function setLimit(count, period, burst) {
return;
}
const key = RATE_LIMIT_STORE_KEY + user + ':' + RATE_LIMIT_ENDPOINTS_GROUPS.ENDPOINT_8;
const key = getStoreKey(user, RATE_LIMIT_ENDPOINTS_GROUPS.ENDPOINT_8);
redisClient.hset(key, 'b', burst, 'c', count, 'p', period, function() {
keysToDelete.push(key);
});