Shared backoff policy for upload retries, used both by the retry middleware on [`REQUEST_CLIENT`] and by the manual stream-retry loop in the uploader. Under `cfg(test)` the intervals are shrunk to milliseconds so retry tests don't sleep through the real exponential backoff (1s, 2s, 4s).
()
| 13 | /// `cfg(test)` the intervals are shrunk to milliseconds so retry tests don't sleep |
| 14 | /// through the real exponential backoff (1s, 2s, 4s). |
| 15 | pub fn upload_backoff() -> ExponentialBackoff { |
| 16 | let builder = ExponentialBackoff::builder(); |
| 17 | #[cfg(test)] |
| 18 | let builder = builder.retry_bounds( |
| 19 | std::time::Duration::from_millis(1), |
| 20 | std::time::Duration::from_millis(5), |
| 21 | ); |
| 22 | builder.build_with_max_retries(UPLOAD_RETRY_COUNT) |
| 23 | } |
| 24 | |
| 25 | pub static REQUEST_CLIENT: LazyLock<ClientWithMiddleware> = LazyLock::new(|| { |
| 26 | ClientWithMiddlewareBuilder::new(ClientBuilder::new().user_agent(USER_AGENT).build().unwrap()) |
no outgoing calls
no test coverage detected