redis keys in easier way
This commit is contained in:
@@ -5,7 +5,7 @@ const TestClient = require('../support/test-client');
|
||||
const redis = require('redis');
|
||||
const {
|
||||
RATE_LIMIT_ENDPOINTS_GROUPS,
|
||||
RATE_LIMIT_STORE_KEY
|
||||
getStoreKey
|
||||
} = require('../../lib/cartodb/middleware/rate-limit');
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ function setLimit(count, period, burst) {
|
||||
return;
|
||||
}
|
||||
|
||||
const key = RATE_LIMIT_STORE_KEY + user + ':' + RATE_LIMIT_ENDPOINTS_GROUPS.ENDPOINT_1;
|
||||
const key = getStoreKey(user, RATE_LIMIT_ENDPOINTS_GROUPS.ENDPOINT_1);
|
||||
redisClient.hset(key, 'b', burst, 'c', count, 'p', period, () => {
|
||||
keysToDelete.push(key);
|
||||
});
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user