Skip to content

Commit

Permalink
Only log POST and DELETE requests in the request_log table
Browse files Browse the repository at this point in the history
  • Loading branch information
NolanTrem committed Jan 8, 2025
1 parent f78dedd commit 28ef06b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions py/core/main/api/v3/base_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,11 @@ async def rate_limit_dependency(
try:
yield
finally:
# 4) Log the request afterwards
await self.providers.database.limits_handler.log_request(
user_id, route
)
# 4) Log only POST and DELETE requests
if request.method in ["POST", "DELETE"]:
await self.providers.database.limits_handler.log_request(
user_id, route
)

async def websocket_rate_limit_dependency(websocket: WebSocket):
# Example: if you want to rate-limit websockets similarly
Expand Down

0 comments on commit 28ef06b

Please sign in to comment.