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

Store rate limiter-related metadata in the database for more resilience #629

Merged
merged 5 commits into from Jan 29, 2024

Conversation

sabaimran
Copy link
Collaborator

Incoming

  • Add a new database model UserRequests to keep state of the number of requests made per API/window per user
  • This helps maintain state even between server restarts
  • Allows you to scale up workers on your service without having to implement sticky routing
  • We could pair this with an in-memory cache if latency becomes an issue

- This helps maintain state even between server restarts
- Allows you to scale up workers on your service without having to implement sticky routing
Copy link
Member

@debanjum debanjum left a comment

Choose a reason for hiding this comment

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

Looks good!

src/khoj/configure.py Show resolved Hide resolved
src/khoj/database/migrations/0029_userrequests.py Outdated Show resolved Hide resolved
@sabaimran sabaimran merged commit 4fb8d5c into master Jan 29, 2024
9 checks passed
@sabaimran sabaimran deleted the fix/rate-limit-in-db branch January 29, 2024 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants