From 7e4a61f2ac3e49b4189fd31818f585dc58a65ef2 Mon Sep 17 00:00:00 2001 From: sabaimran Date: Wed, 12 Jun 2024 21:39:02 +0530 Subject: [PATCH] Disable rate limiting if billing is not enabled --- src/khoj/routers/helpers.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/khoj/routers/helpers.py b/src/khoj/routers/helpers.py index 503d5b1f..01e0b8c7 100644 --- a/src/khoj/routers/helpers.py +++ b/src/khoj/routers/helpers.py @@ -788,6 +788,10 @@ class ApiUserRateLimiter: self.slug = slug def __call__(self, request: Request): + # Rate limiting disabled if billing is disabled + if state.billing_enabled is False: + return + # Rate limiting is disabled if user unauthenticated. # Other systems handle authentication if not request.user.is_authenticated: