Skip to content

Commit 8cb4b78

Browse files
committed
buck2_common(http): wire up DispatchableHttpRetryWarning trait to fire
Summary: This switches both the materializer and the manifold client to use the new interface, all at once. Signed-off-by: Austin Seipp <[email protected]> Change-Id: I6d061db6956e2133e33a74d79bb2f583
1 parent ef7fe55 commit 8cb4b78

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

app/buck2_common/src/http/retries.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ impl DispatchableHttpRetryWarning for NoopDispatchableHttpRetryWarning {
7070
}
7171

7272
pub async fn http_retry<Exec, F, T, E, R>(
73-
_url: &str,
74-
_dispatch_retry_warning: R,
73+
url: &str,
74+
dispatch_retry_warning: R,
7575
exec: Exec,
7676
mut intervals: Vec<Duration>,
7777
) -> Result<T, E>
@@ -84,6 +84,7 @@ where
8484
intervals.insert(0, Duration::from_secs(0));
8585
let mut backoff = intervals.into_iter().peekable();
8686

87+
let mut retries = 0;
8788
while let Some(duration) = backoff.next() {
8889
tokio::time::sleep(duration).await;
8990

@@ -93,12 +94,9 @@ where
9394

9495
if let Some(http_error) = http_error {
9596
if http_error.is_retryable() {
97+
retries += 1;
9698
if let Some(b) = backoff.peek() {
97-
tracing::warn!(
98-
"Retrying a HTTP error after {} seconds: {:#}",
99-
b.as_secs(),
100-
http_error
101-
);
99+
dispatch_retry_warning.dispatch(&b, retries, url);
102100
continue;
103101
}
104102
}

0 commit comments

Comments
 (0)