FAROS
FAROS copied to clipboard
Provider client retry loop blocks event loop with `time.sleep`
Provider client retry loop blocks event loop with time.sleep
Severity: High
File: backend/app/llm/provider_client.py:245
The chat method's retry loop uses synchronous time.sleep(backoff) between retry attempts. With exponential backoff and multiple retries, this can block the event loop for tens of seconds, especially when structured output is enabled with longer timeouts.
if retries <= max_retries:
backoff = self.settings.RETRY_BACKOFF * (2 ** (retries - 1))
logger.warning(
"Provider request failed (attempt %s/%s): %s. Retrying in %ss...",
retries,
max_retries,
e,
backoff,
)
time.sleep(backoff)
Why it matters
A single failing LLM provider can block all concurrent requests across the platform. During provider outages, the entire backend becomes unresponsive.