upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/purgatory/sync/throttle.rs
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2026-01-07 17:16:37 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2026-01-07 17:16:37 +0000
commit42bf1196003c0b39179d8c9d2c07ecf9a83a4a74 (patch)
treed276dc3ac0e904f595d7ce88c30751112439311c /src/purgatory/sync/throttle.rs
parentb71111cc25b99acab786ece4607cb60e9cbebae4 (diff)
fix: resolve clippy warnings
- Prefix unused variable auth_result with underscore - Prefix unused field git_data_path with underscore in Purgatory struct - Add #[allow(clippy::too_many_arguments)] to handle_receive_pack - Replace len() >= 1 with !is_empty() - Replace .last() with .next_back() on DoubleEndedIterator - Fix doc list item overindentation - Replace map_or(true, ...) with is_none_or(...) - Replace map_or(false, ...) with is_some_and(...)
Diffstat (limited to 'src/purgatory/sync/throttle.rs')
-rw-r--r--src/purgatory/sync/throttle.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/purgatory/sync/throttle.rs b/src/purgatory/sync/throttle.rs
index 05b0878..e6efe1f 100644
--- a/src/purgatory/sync/throttle.rs
+++ b/src/purgatory/sync/throttle.rs
@@ -152,7 +152,7 @@ impl DomainThrottle {
152 while self 152 while self
153 .request_times 153 .request_times
154 .front() 154 .front()
155 .map_or(false, |t| now.duration_since(*t) >= window) 155 .is_some_and(|t| now.duration_since(*t) >= window)
156 { 156 {
157 self.request_times.pop_front(); 157 self.request_times.pop_front();
158 } 158 }
@@ -299,7 +299,7 @@ impl ThrottleManager {
299 /// Returns true if the domain has no capacity for another request, 299 /// Returns true if the domain has no capacity for another request,
300 /// either due to concurrent limit or rate limit. 300 /// either due to concurrent limit or rate limit.
301 pub fn is_throttled(&self, domain: &str) -> bool { 301 pub fn is_throttled(&self, domain: &str) -> bool {
302 self.throttles.get(domain).map_or(false, |entry| { 302 self.throttles.get(domain).is_some_and(|entry| {
303 let throttle = entry.lock().unwrap(); 303 let throttle = entry.lock().unwrap();
304 !throttle.has_capacity() 304 !throttle.has_capacity()
305 }) 305 })