|
5 | 5 | Expected gaps model OperationRepo's per-operation backoff: |
6 | 6 | - After the Nth retryable failure an operation waits N * 15s (opRepoDefaultFailRetryBackoff), |
7 | 7 | capped at 1h. There is no jitter and HttpClient does not re-send on its own. |
8 | | - - Retry-After is the minimum wait, capped at 1h. An unparsable value counts as 60s. |
| 8 | + - Retry-After is the minimum wait, capped at 1h. An unparsable value, or a 429 without one, |
| 9 | + counts as 60s. |
9 | 10 | - The queue may wait up to opRepoExecutionInterval (5s) more if something else was enqueued |
10 | 11 | during the backoff, so a few seconds of slack is allowed. |
11 | 12 | A foreground or network return ends the backoff early (but not Retry-After), so short gaps right |
@@ -33,8 +34,10 @@ def route_key(entry): |
33 | 34 | return f"{entry['method']} {path}" |
34 | 35 |
|
35 | 36 |
|
36 | | -def backoff_window(failures, retry_after): |
| 37 | +def backoff_window(failures, status, retry_after): |
37 | 38 | low = min(failures * BACKOFF_STEP, MAX_DELAY) |
| 39 | + if retry_after is None and status == 429: |
| 40 | + retry_after = RETRY_AFTER_PARSE_FAIL |
38 | 41 | has_floor = retry_after is not None |
39 | 42 | if has_floor: |
40 | 43 | try: |
@@ -95,7 +98,7 @@ def main(): |
95 | 98 | expected = None |
96 | 99 | else: |
97 | 100 | failures += 1 |
98 | | - low, high, has_floor = backoff_window(failures, entry.get("retry_after")) |
| 101 | + low, high, has_floor = backoff_window(failures, status, entry.get("retry_after")) |
99 | 102 | expected = (low, high, f"backoff #{failures}" + (", Retry-After" if has_floor else "")) |
100 | 103 | print("\n* = failure injected by the proxy") |
101 | 104 |
|
|
0 commit comments