0

Update rate-limiter.ts

This commit is contained in:
Nicolas 2024-06-06 11:56:00 -07:00
parent 1129d33321
commit 27a8fd0c3c

View File

@ -69,19 +69,19 @@ const createRateLimiter = (keyPrefix, points) =>
export const previewRateLimiter = createRateLimiter( export const previewRateLimiter = createRateLimiter(
"preview", "preview",
RATE_LIMITS.preview RATE_LIMITS.preview.default
); );
export const serverRateLimiter = createRateLimiter( export const serverRateLimiter = createRateLimiter(
"server", "server",
RATE_LIMITS.account RATE_LIMITS.account.default
); );
export const crawlStatusRateLimiter = createRateLimiter( export const crawlStatusRateLimiter = createRateLimiter(
"crawl-status", "crawl-status",
RATE_LIMITS.crawlStatus RATE_LIMITS.crawlStatus.default
); );
export const testSuiteRateLimiter = createRateLimiter( export const testSuiteRateLimiter = createRateLimiter(
"test-suite", "test-suite",
RATE_LIMITS.testSuite RATE_LIMITS.testSuite.default
); );
export function getRateLimiter( export function getRateLimiter(
@ -89,6 +89,7 @@ export function getRateLimiter(
token: string, token: string,
plan?: string plan?: string
) { ) {
console.log(`${mode}-${plan}`);
if (token.includes("a01ccae") || token.includes("6254cf9")) { if (token.includes("a01ccae") || token.includes("6254cf9")) {
return testSuiteRateLimiter; return testSuiteRateLimiter;
} }
@ -100,5 +101,6 @@ export function getRateLimiter(
const points = const points =
rateLimitConfig[planKey] || rateLimitConfig.default || rateLimitConfig; // 5 rateLimitConfig[planKey] || rateLimitConfig.default || rateLimitConfig; // 5
console.log(`${mode}-${planKey}`);
return createRateLimiter(`${mode}-${planKey}`, points); return createRateLimiter(`${mode}-${planKey}`, points);
} }