Skip to content

Commit 4ae21f1

Browse files
committed
refactor: Update .env.sample and rate-limiter.ts
- Update QUICK_CV_RATE_LIMIT in .env.sample to 3 requests per 15 minutes - Add QUICK_CV_RATE_LIMIT_DURATION in .env.sample with a value of 15 minutes - Update RATE_LIMIT_COUNT and limiter duration in rate-limiter.ts to reflect the new rate limit
1 parent 8b25025 commit 4ae21f1

File tree

3 files changed

+4
-10
lines changed

3 files changed

+4
-10
lines changed

.env

Lines changed: 0 additions & 9 deletions
This file was deleted.

.env.sample

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ GROQ_API_KEY=xxxxxxxxx
33
UPSTACH_REDIS_URL=xxxxxxxxx
44
UPSTASH_REDIS_PASSWORD=xxxxxxxxx
55
QUICK_CV_RATE_LIMIT=100 # 100 requests per 15 minutes
6+
QUICK_CV_RATE_LIMIT=3 # 100 requests per 15 minutes
7+
QUICK_CV_RATE_LIMIT_DURATION=15 # 15 minutes
68

79

810
# SYSTEM Prompts file name all localated in ./prompts/

helpers/rate-limiter.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ import Redis from "./redis";
33
import { getIp } from "./commons/server";
44

55
const RATE_LIMIT_COUNT = parseInt(process.env.QUICK_CV_RATE_LIMIT ?? "20");
6+
const RATE_LIMIT_DURATION = parseInt(process.env.QUICK_CV_RATE_LIMIT_DURATION ?? "60")
67

78
export const ResumeGeneratorLimiter = new Ratelimit({
89
redis: Redis,
9-
limiter: Ratelimit.slidingWindow(RATE_LIMIT_COUNT, "60 m"),
10+
limiter: Ratelimit.slidingWindow(RATE_LIMIT_COUNT, `${RATE_LIMIT_DURATION} m`),
1011
analytics: true,
1112
prefix: "ratelimit:resume-generator",
1213
});

0 commit comments

Comments
 (0)