cleanups for clippy

This commit is contained in:
Mingwei Samuel 2024-12-19 09:54:52 -08:00
parent a2e2b6ed6c
commit 19c328e520
2 changed files with 9 additions and 9 deletions

View file

@ -125,14 +125,6 @@ impl RegionalRequester {
// Is retryable, do exponential backoff if retry-after wasn't specified.
// 1 sec, 2 sec, 4 sec, 8 sec.
match retry_after {
None => {
let delay = Duration::from_secs(2_u64.pow(retries as u32));
log::debug!("Response {} (retried {} times), NO `retry-after`, using exponential backoff, retrying after {:?}.", status, retries, delay);
let backoff = sleep(delay);
#[cfg(feature = "tracing")]
let backoff = backoff.instrument(tracing::info_span!("backoff"));
backoff.await;
}
Some(delay) => {
log::debug!(
"Response {} (retried {} times), `retry-after` set, retrying after {:?}.",
@ -141,6 +133,14 @@ impl RegionalRequester {
delay
);
}
None => {
let delay = Duration::from_secs(2_u64.pow(retries as u32));
log::debug!("Response {} (retried {} times), NO `retry-after`, using exponential backoff, retrying after {:?}.", status, retries, delay);
let backoff = sleep(delay);
#[cfg(feature = "tracing")]
let backoff = backoff.instrument(tracing::info_span!("backoff"));
backoff.await;
}
}
retries += 1;
}

View file

@ -116,7 +116,7 @@ impl VectorTokenBucket {
// `Instant::now()` call or something.
if let Some(cutoff) = Instant::now().checked_sub(self.duration + self.duration_overhead) {
// Pop off timestamps that are beyound the bucket duration.
while timestamps.back().map_or(false, |ts| *ts < cutoff) {
while timestamps.back().is_some_and(|ts| *ts < cutoff) {
timestamps.pop_back();
}
}