fix: constants timeframe in seconds (#2434)

This commit is contained in:
Shubham Palriwala
2024-04-12 16:40:20 +05:30
committed by GitHub
parent 1b5d3c216f
commit 8ef74fdaff
2 changed files with 6 additions and 6 deletions

View File

@@ -10,7 +10,7 @@ type Options = {
const inMemoryRateLimiter = (options: Options) => {
const tokenCache = new LRUCache<string, number>({
max: 1000,
ttl: options.interval,
ttl: options.interval * 1000, // converts to expected input of milliseconds
});
return async (token: string) => {

View File

@@ -150,24 +150,24 @@ export const SURVEY_BG_COLORS = [
// Rate Limiting
export const SIGNUP_RATE_LIMIT = {
interval: 60 * 60 * 1000, // 60 minutes
interval: 60 * 60, // 60 minutes
allowedPerInterval: 30,
};
export const LOGIN_RATE_LIMIT = {
interval: 15 * 60 * 1000, // 15 minutes
interval: 15 * 60, // 15 minutes
allowedPerInterval: 30,
};
export const CLIENT_SIDE_API_RATE_LIMIT = {
interval: 5 * 60 * 1000, // 5 minutes
interval: 5 * 60, // 5 minutes
allowedPerInterval: 200,
};
export const SHARE_RATE_LIMIT = {
interval: 60 * 60 * 1000, // 60 minutes
interval: 60 * 60, // 60 minutes
allowedPerInterval: 30,
};
export const SYNC_USER_IDENTIFICATION_RATE_LIMIT = {
interval: 60 * 1000, // 1 minute
interval: 60, // 1 minute
allowedPerInterval: 5,
};