fix rate limit set to default (#83)

This commit is contained in:
KM Koushik
2024-11-29 10:47:01 +11:00
committed by GitHub
parent 26f42e6e9e
commit 5e297ac23a
4 changed files with 7 additions and 2 deletions

View File

@@ -18,6 +18,7 @@ import { EmailContent } from "~/types";
function getSesClient(region: string) {
return new SESv2Client({
region: region,
endpoint: env.AWS_SES_ENDPOINT,
credentials: {
accessKeyId: env.AWS_ACCESS_KEY,
secretAccessKey: env.AWS_SECRET_KEY,

View File

@@ -7,7 +7,7 @@ import { getTeamAndApiKey } from "../service/api-service";
const rateLimitCache = new TTLCache({
ttl: 1000, // 1 second
max: env.API_RATE_LIMIT,
max: 10000,
});
/**
@@ -72,7 +72,7 @@ const checkRateLimit = (token: string) => {
rateLimit = rateLimit ?? 0;
if (rateLimit >= 2) {
if (rateLimit >= env.API_RATE_LIMIT) {
throw new UnsendApiError({
code: "RATE_LIMITED",
message: `Rate limit exceeded, ${env.API_RATE_LIMIT} requests per second`,