Spaces:
Running on T4
Running on T4
Claude commited on
Add 502/504 and hyphenated Time-out to retry list
Browse filesHF API returned '504 Gateway Time-out' which wasn't matched by
the existing retry logic (only checked 500/503/429). Now retries
on all common gateway errors (502, 504) and both timeout spellings.
https://claude.ai/code/session_01DPirJ78YYN4fJUvUFJ5D6V
- layer2/customer_sim.py +1 -1
- layer2/hf_agent.py +1 -1
layer2/customer_sim.py
CHANGED
|
@@ -103,7 +103,7 @@ class CustomerSimulator:
|
|
| 103 |
"Get more credits at https://huggingface.co/settings/billing"
|
| 104 |
) from e
|
| 105 |
# Retry on transient server errors (500, 503, 429, timeouts)
|
| 106 |
-
if any(code in err_str for code in ("500", "503", "429", "timeout", "Timeout")):
|
| 107 |
last_err = e
|
| 108 |
wait = 2 ** (attempt + 1) # 2, 4, 8, 16s
|
| 109 |
logger.warning(
|
|
|
|
| 103 |
"Get more credits at https://huggingface.co/settings/billing"
|
| 104 |
) from e
|
| 105 |
# Retry on transient server errors (500, 503, 429, timeouts)
|
| 106 |
+
if any(code in err_str for code in ("500", "502", "503", "504", "429", "timeout", "Timeout", "Time-out")):
|
| 107 |
last_err = e
|
| 108 |
wait = 2 ** (attempt + 1) # 2, 4, 8, 16s
|
| 109 |
logger.warning(
|
layer2/hf_agent.py
CHANGED
|
@@ -93,7 +93,7 @@ class HFAgent:
|
|
| 93 |
"HF API credits depleted. "
|
| 94 |
"Get more credits at https://huggingface.co/settings/billing"
|
| 95 |
) from e
|
| 96 |
-
if any(code in err_str for code in ("500", "503", "429", "timeout", "Timeout")):
|
| 97 |
last_err = e
|
| 98 |
wait = 2 ** (attempt + 1) # 2, 4, 8, 16s
|
| 99 |
logger.warning(
|
|
|
|
| 93 |
"HF API credits depleted. "
|
| 94 |
"Get more credits at https://huggingface.co/settings/billing"
|
| 95 |
) from e
|
| 96 |
+
if any(code in err_str for code in ("500", "502", "503", "504", "429", "timeout", "Timeout", "Time-out")):
|
| 97 |
last_err = e
|
| 98 |
wait = 2 ** (attempt + 1) # 2, 4, 8, 16s
|
| 99 |
logger.warning(
|