fix rate limit set to default (#83)
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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`,
|
||||
|
||||
Reference in New Issue
Block a user