From bf9a9c72838c76c11e87672cf12185d042b78237 Mon Sep 17 00:00:00 2001 From: Debanjum Date: Tue, 22 Jul 2025 18:45:34 -0500 Subject: [PATCH] Disable per user websocket connection limits in anon or debug mode This rate limiting is only relevant in production scenarios. --- src/khoj/routers/helpers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/khoj/routers/helpers.py b/src/khoj/routers/helpers.py index 4c286980..40b30c23 100644 --- a/src/khoj/routers/helpers.py +++ b/src/khoj/routers/helpers.py @@ -2099,7 +2099,8 @@ class WebSocketConnectionManager: user=user, slug__startswith=self.connection_slug_prefix ).acount() - return active_connections < max_connections + # Restrict max active connections per user in production + return active_connections < max_connections or state.anonymous_mode or in_debug_mode() async def register_connection(self, user: KhojUser, connection_id: str) -> None: """Register a new WebSocket connection."""