Commit d4152fe
Fix MethodError when an armed retry is abandoned at the request deadline (#1324)
When a retry has been armed (its retry-bucket reservation acquired) but
_sleep_retry_delay! bails out because the backoff delay would exceed the
request deadline, the finally block refunded the reservation with
`release(bucket, token, nothing)`. `release` only accepts an `Int` failure
cost, so instead of gracefully giving up and returning the last response,
the request failed with
MethodError: no method matching release(::RetryBucket, ::RetryToken, ::Nothing)
Pass the cost through `_retry_bucket_failure_cost(nothing)` (i.e. 0, a
full refund) as intended. This path triggers in the wild whenever a
deadline-bounded request (e.g. `request_timeout` set) is retried against
a slow or unavailable server and the backoff no longer fits within the
deadline.
Add a regression test covering the abandoned-retry path, including that
the reservation is refunded in full.
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>1 parent 04a21cf commit d4152fe
2 files changed
Lines changed: 34 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
206 | 206 | | |
207 | 207 | | |
208 | 208 | | |
209 | | - | |
| 209 | + | |
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
511 | 511 | | |
512 | 512 | | |
513 | 513 | | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
514 | 547 | | |
515 | 548 | | |
516 | 549 | | |
| |||
0 commit comments