Don't retry for PaymentRequiredError or ModelRequestLimitReachedError (#36075)
Release Notes: - Don't auto-retry for "payment required" or "model request limit reached" errors (since retrying won't help)
This commit is contained in:
parent
255bb0a3f8
commit
48ae02c1ca
1 changed files with 9 additions and 0 deletions
|
@ -2268,6 +2268,15 @@ impl Thread {
|
||||||
max_attempts: 3,
|
max_attempts: 3,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Other(err)
|
||||||
|
if err.is::<PaymentRequiredError>()
|
||||||
|
|| err.is::<ModelRequestLimitReachedError>() =>
|
||||||
|
{
|
||||||
|
// Retrying won't help for Payment Required or Model Request Limit errors (where
|
||||||
|
// the user must upgrade to usage-based billing to get more requests, or else wait
|
||||||
|
// for a significant amount of time for the request limit to reset).
|
||||||
|
None
|
||||||
|
}
|
||||||
// Conservatively assume that any other errors are non-retryable
|
// Conservatively assume that any other errors are non-retryable
|
||||||
HttpResponseError { .. } | Other(..) => Some(RetryStrategy::Fixed {
|
HttpResponseError { .. } | Other(..) => Some(RetryStrategy::Fixed {
|
||||||
delay: BASE_RETRY_DELAY,
|
delay: BASE_RETRY_DELAY,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue