mirror of
https://github.com/MingweiSamuel/Riven.git
synced 2024-12-25 10:26:31 +00:00
cleanups for clippy
This commit is contained in:
parent
a2e2b6ed6c
commit
19c328e520
2 changed files with 9 additions and 9 deletions
|
@ -125,14 +125,6 @@ impl RegionalRequester {
|
||||||
// Is retryable, do exponential backoff if retry-after wasn't specified.
|
// Is retryable, do exponential backoff if retry-after wasn't specified.
|
||||||
// 1 sec, 2 sec, 4 sec, 8 sec.
|
// 1 sec, 2 sec, 4 sec, 8 sec.
|
||||||
match retry_after {
|
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) => {
|
Some(delay) => {
|
||||||
log::debug!(
|
log::debug!(
|
||||||
"Response {} (retried {} times), `retry-after` set, retrying after {:?}.",
|
"Response {} (retried {} times), `retry-after` set, retrying after {:?}.",
|
||||||
|
@ -141,6 +133,14 @@ impl RegionalRequester {
|
||||||
delay
|
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;
|
retries += 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,7 +116,7 @@ impl VectorTokenBucket {
|
||||||
// `Instant::now()` call or something.
|
// `Instant::now()` call or something.
|
||||||
if let Some(cutoff) = Instant::now().checked_sub(self.duration + self.duration_overhead) {
|
if let Some(cutoff) = Instant::now().checked_sub(self.duration + self.duration_overhead) {
|
||||||
// Pop off timestamps that are beyound the bucket duration.
|
// 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();
|
timestamps.pop_back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue