fix: handle rate limiting with backoff, fix auth error detection
All checks were successful
Build and Push Monarch MCP Docker Image / build (push) Successful in 22s
All checks were successful
Build and Push Monarch MCP Docker Image / build (push) Successful in 22s
This commit is contained in:
@@ -123,8 +123,15 @@ def retry_on_auth_error(max_retries: int = 1):
|
||||
"401" in error_str
|
||||
or "unauthorized" in error_str
|
||||
or "authentication" in error_str
|
||||
or isinstance(e, (RequestFailedException, LoginFailedException))
|
||||
or isinstance(e, LoginFailedException)
|
||||
)
|
||||
is_rate_limit = "429" in error_str or "rate limit" in error_str
|
||||
|
||||
if is_rate_limit and attempt < max_retries:
|
||||
import asyncio
|
||||
logger.warning(f"Rate limited in {func.__name__}, waiting 15s before retry...")
|
||||
await asyncio.sleep(15)
|
||||
continue
|
||||
|
||||
if is_auth_error and attempt < max_retries:
|
||||
logger.warning(
|
||||
|
||||
Reference in New Issue
Block a user