This commit is contained in:
Nicolas 2024-08-26 16:05:11 -03:00
parent d591e0f51c
commit 5606fe5870
2 changed files with 15 additions and 2 deletions

View File

@ -222,7 +222,8 @@ export async function supaAuthenticateUser(
rateLimiter = getRateLimiter(
RateLimiterMode.Scrape,
token,
subscriptionData.plan
subscriptionData.plan,
teamId
);
break;
case RateLimiterMode.Search:

View File

@ -84,16 +84,28 @@ export const testSuiteRateLimiter = new RateLimiterRedis({
duration: 60, // Duration in seconds
});
export const devBRateLimiter = new RateLimiterRedis({
storeClient: redisRateLimitClient,
keyPrefix: "dev-b",
points: 1200,
duration: 60, // Duration in seconds
});
export function getRateLimiter(
mode: RateLimiterMode,
token: string,
plan?: string
plan?: string,
teamId?: string
) {
if (token.includes("a01ccae") || token.includes("6254cf9") || token.includes("0f96e673")) {
return testSuiteRateLimiter;
}
if(teamId === process.env.DEV_B_TEAM_ID) {
return devBRateLimiter;
}
const rateLimitConfig = RATE_LIMITS[mode]; // {default : 5}
if (!rateLimitConfig) return serverRateLimiter;