tests: 429 rate-limiting fix — polling 5s/8s/12s/20s, 429-backoff 5s/10s/20s/40s, rate limiter 15 calls/min
This commit is contained in:
@@ -94,10 +94,10 @@ class RateLimiter:
|
||||
"""Simple token-bucket rate limiter.
|
||||
|
||||
Allows max_tokens calls per window_seconds. Thread-safe via lock.
|
||||
Default: 30 calls/minute (was 60 — RC triggers 429 at 3-4 calls in <10s).
|
||||
Default: 15 calls/minute (was 30 — RC triggers 429 aggressively).
|
||||
"""
|
||||
|
||||
def __init__(self, max_tokens: int = 30, window_seconds: float = 60.0):
|
||||
def __init__(self, max_tokens: int = 15, window_seconds: float = 60.0):
|
||||
self.max_tokens = max_tokens
|
||||
self.window_seconds = window_seconds
|
||||
self.tokens = float(max_tokens)
|
||||
@@ -138,7 +138,7 @@ _rate_limiter: RateLimiter | None = None
|
||||
def _get_rate_limiter() -> RateLimiter:
|
||||
global _rate_limiter
|
||||
if _rate_limiter is None:
|
||||
_rate_limiter = RateLimiter(max_tokens=30, window_seconds=60.0)
|
||||
_rate_limiter = RateLimiter(max_tokens=15, window_seconds=60.0)
|
||||
return _rate_limiter
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user