-
Couldn't load subscription status.
- Fork 25
Add rate limiting for user queries #111
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
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-authored-by: gkorland <[email protected]>
Co-authored-by: gkorland <[email protected]>
Co-authored-by: gkorland <[email protected]>
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Join our Discord community for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
Dependency ReviewThe following issues were found:
|
This PR implements daily rate limiting for user queries to help manage resource usage and ensure fair access across all users.
Changes Made
Core Implementation
api/rate_limiter.py: New utility class that handles rate limiting logic using FalkorDB for persistent storageapi/routes/graphs.py: Integrated rate limiting into the main query endpoint (POST /graphs/{graph_id}).env.example: AddedDAILY_QUERY_LIMITconfiguration optionConfiguration
Users can now configure the daily query limit via environment variable:
How It Works
Database Schema
Query counts are stored as
QueryCountnodes in FalkorDB:Error Response
When rate limit is exceeded, users receive:
{ "detail": "Daily query limit exceeded. You can make 100 queries per day.", "error_code": "RATE_LIMIT_EXCEEDED", "daily_limit": 100, "reset_time": "UTC midnight" }Testing
Documentation
Updated README.md with complete configuration guide and usage examples.
Fixes #12.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.