mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-14 09:03:16 +00:00
fix(proxy): stay within the ruff strict-rule TRY300 budget
Move the success return of the Redis spend counter delete retry loop into the try's else branch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
d36ae0f9bf
commit
7e9df3c19a
1 changed files with 2 additions and 1 deletions
|
|
@ -630,7 +630,6 @@ class ResetBudgetJob:
|
|||
for attempt in range(RESET_BUDGET_SPEND_COUNTER_RESET_MAX_ATTEMPTS):
|
||||
try:
|
||||
await redis_cache.async_delete_cache(key=counter_key)
|
||||
return
|
||||
except Exception as redis_err: # noqa: BLE001 # any Redis failure here is worth a retry, not just specific ones
|
||||
verbose_proxy_logger.warning(
|
||||
"Attempt %d/%d to reset spend counter %s in Redis failed: %s",
|
||||
|
|
@ -641,6 +640,8 @@ class ResetBudgetJob:
|
|||
)
|
||||
if attempt < RESET_BUDGET_SPEND_COUNTER_RESET_MAX_ATTEMPTS - 1:
|
||||
await asyncio.sleep(RESET_BUDGET_SPEND_COUNTER_RESET_RETRY_DELAY_SECONDS)
|
||||
else:
|
||||
return
|
||||
verbose_proxy_logger.error(
|
||||
"Failed to reset spend counter %s in Redis after %d attempts; budget may be "
|
||||
"over-enforced until the counter expires.",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue