-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: increase rate limit for client api endpoints #1904
feat: increase rate limit for client api endpoints #1904
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 2 Ignored Deployments
|
Thank you for following the naming conventions for pull request titles! 🙏 |
71a8dd7
to
efa8b44
Compare
packages/lib/constants.tsInstead of using magic numbers for time intervals, it would be more readable to define constants for these values. This will make the code easier to understand and maintain. const ONE_MINUTE = 60 * 1000;
const FIVE_MINUTES = 5 * ONE_MINUTE;
const FIFTEEN_MINUTES = 15 * ONE_MINUTE;
const ONE_HOUR = 60 * ONE_MINUTE;
export const LOGIN_RATE_LIMIT = {
interval: FIFTEEN_MINUTES,
allowedPerInterval: 30,
};
export const CLIENT_SIDE_API_RATE_LIMIT = {
interval: FIVE_MINUTES,
allowedPerInterval: 100,
};
export const SHARE_RATE_LIMIT = {
interval: ONE_HOUR,
allowedPerInterval: 30,
};
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ShubhamPalriwala looks great, thanks for the fix 😊
Is there anyway to override these constants with environment variables? |
@connorwinston Why do you want to overwrite them? what problem are you facing? |
@mattinannt I would like to increase the number of requests that can be made specifically for shares and the other limits in general, they are pretty low. Additionally, the way I have this hosted/internally protected on our intranet means that some routes receive the same ip regardless of the user, which kind of breaks this. It would be nice to either configure the rate limiter amounts via ENV or disable/enable the ratelimit in general via ENV. |
What does this PR do?
Increases the client side API (including response submissions) rate limits to 100 per 5 mins! 🤞🏼
Checklist
Required
pnpm build
console.logs
git pull origin main
Appreciated