From 28ef06b42d5b167480e2e4ed8cd0508cfb64c974 Mon Sep 17 00:00:00 2001 From: NolanTrem <34580718+NolanTrem@users.noreply.github.com> Date: Wed, 8 Jan 2025 12:27:44 -0800 Subject: [PATCH] Only log POST and DELETE requests in the request_log table --- py/core/main/api/v3/base_router.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/py/core/main/api/v3/base_router.py b/py/core/main/api/v3/base_router.py index 2cc6d13ea..ddc4a2f0e 100644 --- a/py/core/main/api/v3/base_router.py +++ b/py/core/main/api/v3/base_router.py @@ -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