From 1129d33321a35a6f30a26b18f629fb7cbbc15593 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Thu, 6 Jun 2024 11:53:12 -0700 Subject: [PATCH 1/3] Update rate-limiter.ts --- apps/api/src/services/rate-limiter.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/api/src/services/rate-limiter.ts b/apps/api/src/services/rate-limiter.ts index d0f937f..edaa84c 100644 --- a/apps/api/src/services/rate-limiter.ts +++ b/apps/api/src/services/rate-limiter.ts @@ -37,15 +37,19 @@ const RATE_LIMITS = { growth: 500, }, preview: { + free: 5, default: 5, }, account: { + free: 20, default: 20, }, crawlStatus: { + free: 150, default: 150, }, testSuite: { + free: 10000, default: 10000, }, }; From 27a8fd0c3c9f1e45e12a6b30326746d82163960f Mon Sep 17 00:00:00 2001 From: Nicolas Date: Thu, 6 Jun 2024 11:56:00 -0700 Subject: [PATCH 2/3] Update rate-limiter.ts --- apps/api/src/services/rate-limiter.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/api/src/services/rate-limiter.ts b/apps/api/src/services/rate-limiter.ts index edaa84c..eef4d26 100644 --- a/apps/api/src/services/rate-limiter.ts +++ b/apps/api/src/services/rate-limiter.ts @@ -69,19 +69,19 @@ const createRateLimiter = (keyPrefix, points) => export const previewRateLimiter = createRateLimiter( "preview", - RATE_LIMITS.preview + RATE_LIMITS.preview.default ); export const serverRateLimiter = createRateLimiter( "server", - RATE_LIMITS.account + RATE_LIMITS.account.default ); export const crawlStatusRateLimiter = createRateLimiter( "crawl-status", - RATE_LIMITS.crawlStatus + RATE_LIMITS.crawlStatus.default ); export const testSuiteRateLimiter = createRateLimiter( "test-suite", - RATE_LIMITS.testSuite + RATE_LIMITS.testSuite.default ); export function getRateLimiter( @@ -89,6 +89,7 @@ export function getRateLimiter( token: string, plan?: string ) { + console.log(`${mode}-${plan}`); if (token.includes("a01ccae") || token.includes("6254cf9")) { return testSuiteRateLimiter; } @@ -100,5 +101,6 @@ export function getRateLimiter( const points = rateLimitConfig[planKey] || rateLimitConfig.default || rateLimitConfig; // 5 + console.log(`${mode}-${planKey}`); return createRateLimiter(`${mode}-${planKey}`, points); } From de06b13debd69f9abb13173f8ab1df75f9b70afd Mon Sep 17 00:00:00 2001 From: Nicolas Date: Thu, 6 Jun 2024 11:56:22 -0700 Subject: [PATCH 3/3] Update rate-limiter.ts --- apps/api/src/services/rate-limiter.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/apps/api/src/services/rate-limiter.ts b/apps/api/src/services/rate-limiter.ts index eef4d26..637ab50 100644 --- a/apps/api/src/services/rate-limiter.ts +++ b/apps/api/src/services/rate-limiter.ts @@ -89,7 +89,6 @@ export function getRateLimiter( token: string, plan?: string ) { - console.log(`${mode}-${plan}`); if (token.includes("a01ccae") || token.includes("6254cf9")) { return testSuiteRateLimiter; } @@ -101,6 +100,5 @@ export function getRateLimiter( const points = rateLimitConfig[planKey] || rateLimitConfig.default || rateLimitConfig; // 5 - console.log(`${mode}-${planKey}`); return createRateLimiter(`${mode}-${planKey}`, points); }