Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

fix: remove default rate limits to avoid breaking UI tests

LearningCircuit9e1c7e176789
diff --git a/src/local_deep_research/security/rate_limiter.py b/src/local_deep_research/security/rate_limiter.py
index b6d82f8a09..1dfa7ae6c1 100644
--- a/src/local_deep_research/security/rate_limiter.py
+++ b/src/local_deep_research/security/rate_limiter.py
@@ -5,9 +5,7 @@ Provides decorators and configuration for rate limiting HTTP requests
to prevent abuse and resource exhaustion.
"""
-from functools import wraps
-
-from flask import g, jsonify, request
+from flask import g
from flask_limiter import Limiter
from flask_limiter.util import get_remote_address
from loguru import logger
@@ -61,7 +59,7 @@ def init_rate_limiter(app):
_limiter = Limiter(
app=app,
key_func=get_user_identifier,
- default_limits=["1000 per day", "200 per hour"],
+ default_limits=[], # No default limits - apply via decorators only
storage_uri="memory://", # Use in-memory storage (for development)
# For production, consider: storage_uri="redis://localhost:6379"
strategy="fixed-window",
@@ -90,43 +88,16 @@ def upload_rate_limit(f):
Returns:
Decorated function with rate limiting
"""
-
- @wraps(f)
- def decorated_function(*args, **kwargs):
+ # Get the limiter and apply the decorator
+ # This will be called when the decorator is applied
+ try:
limiter = get_rate_limiter()
-
- # Define upload-specific limits
- upload_limits = ["10 per minute", "100 per hour"]
-
- # Check if rate limit is exceeded
- try:
- # Manual rate limit check
- for limit in upload_limits:
- if not limiter.check():
- logger.warning(
- f"Rate limit exceeded for {g.get('current_user', 'unknown')} "
- f"on {request.endpoint}"
- )
- return (
- jsonify(
- {
- "error": "Rate limit exceeded. Please try again later.",
- "retry_after": limiter.reset_time,
- }
- ),
- 429,
- )
-
- # Execute the actual function
- return f(*args, **kwargs)
-
- except Exception:
- logger.exception("Rate limiter error")
- # If rate limiter fails, allow the request through
- # (fail open to avoid blocking legitimate users)
- return f(*args, **kwargs)
-
- return decorated_function
+ # Use Flask-Limiter's limit decorator
+ return limiter.limit("10 per minute;100 per hour")(f)
+ except Exception:
+ logger.exception("Rate limiter initialization error")
+ # If limiter fails to initialize, return undecorated function
+ return f
# Export convenience decorator