Skip to content
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

Rate limit all endpoints by default via middleware #64

Merged
merged 2 commits into from
May 6, 2022

Conversation

PSalant726
Copy link
Contributor

@PSalant726 PSalant726 commented May 5, 2022

Closes #57

API Changes

  • Rate limit all endpoints by default via the SlowAPIMiddleware
    • Bumps the rate limit to 20/minute, as it's anticipated that 6/minute will be exceeded by legitimate use in the near term.
    • The affected endpoints have not changed. This change should be completely transparent to legitimate API consumers.
    • In the future, if an endpoint should be excluded from rate limiting, the limiter object can be restored and the @limiter.exempt decorator can be used. See: https://slowapi.readthedocs.io/en/latest/examples/#exempt-a-route-from-the-global-limit

In the future, if an endpoint should be excluded from rate limiting,
the `limiter` object can be restored and `@limiter.exempt` can be used.
See: https://slowapi.readthedocs.io/en/latest/examples/#exempt-a-route-from-the-global-limit
@PSalant726 PSalant726 added the enhancement New feature or request label May 5, 2022
@PSalant726 PSalant726 requested a review from SteveDMurphy May 5, 2022 21:41
@PSalant726 PSalant726 self-assigned this May 5, 2022
SteveDMurphy
SteveDMurphy previously approved these changes May 6, 2022
Copy link
Contributor

@SteveDMurphy SteveDMurphy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice change @PSalant726 🙌🏽

The only question I have is around the 6/minute limit and thinking that we may exceed that occasionally (or eventually) with some of the chained events that can get sent 🤔 might be more to do with the api stuff we dabbled with that I am drawing on

@PSalant726
Copy link
Contributor Author

The intent was to provide a generous limit, just to block obvious spam. I bumped it to 20/minute 🤷‍♂️

@PSalant726 PSalant726 requested a review from SteveDMurphy May 6, 2022 01:39
Copy link
Contributor

@SteveDMurphy SteveDMurphy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Ya I think I remember getting sometimes 10+ events for a single command so 20 should be more than enough 👍🏽

@PSalant726 PSalant726 merged commit d1d8233 into main May 6, 2022
@PSalant726 PSalant726 deleted the rate-limiting-middleware branch May 6, 2022 01:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rate limit API requests via middleware
2 participants