Skip to content

Commit c24eb58

Browse files
committed
fix: Increase burst limit to accommodate legitimate parallel project loading
1 parent 3347e40 commit c24eb58

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

server/handlers/authenticated_ws_handler.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@ def check_execution_limit(self, username, limit=10, window=60):
4141

4242
def check_file_ops_limit(self, username, limit=30, window=10):
4343
"""Check if user can perform file operations (30 per 10 seconds = max 180/min with burst protection)"""
44-
# First check for rapid burst (max 5 requests per 2 seconds)
45-
if not self._check_burst_limit(username, burst_limit=5, burst_window=2):
44+
# First check for rapid burst (max 10 requests per 2 seconds to allow initial project loading)
45+
# Students see 6 projects on login, plus some buffer for legitimate parallel operations
46+
if not self._check_burst_limit(username, burst_limit=10, burst_window=2):
4647
return False
4748

4849
return self._check_limit(self.file_ops, username, limit, window)
@@ -51,8 +52,12 @@ def check_message_limit(self, username, limit=300, window=60):
5152
"""Check general message rate limit (300 per minute default)"""
5253
return self._check_limit(self.messages, username, limit, window)
5354

54-
def _check_burst_limit(self, username, burst_limit=5, burst_window=2):
55-
"""Prevent rapid-fire requests that can overwhelm the server"""
55+
def _check_burst_limit(self, username, burst_limit=10, burst_window=2):
56+
"""Prevent rapid-fire requests that can overwhelm the server
57+
58+
Note: burst_limit of 10 allows students to load 6 projects on login plus buffer
59+
for legitimate parallel operations (auto-save, file switching, etc.)
60+
"""
5661
now = time()
5762
# Remove old burst entries outside the burst window
5863
self.burst_tracker[username] = [t for t in self.burst_tracker[username] if now - t < burst_window]

0 commit comments

Comments
 (0)