MCPcopy Create free account
hub / github.com/CodSpeedHQ/codspeed / upload_backoff

Function upload_backoff

src/request_client.rs:15–23  ·  view source on GitHub ↗

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).

()

Source from the content-addressed store, hash-verified

13/// `cfg(test)` the intervals are shrunk to milliseconds so retry tests don't sleep
14/// through the real exponential backoff (1s, 2s, 4s).
15pub 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
25pub static REQUEST_CLIENT: LazyLock<ClientWithMiddleware> = LazyLock::new(|| {
26 ClientWithMiddlewareBuilder::new(ClientBuilder::new().user_agent(USER_AGENT).build().unwrap())

Callers 2

request_client.rsFile · 0.85
send_streamed_with_retryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected