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-08 00:50:54 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2026-01-08 00:50:54 +0000
commitf75e1c59aacf5ce668fd327e4e3d827511661c2a (patch)
tree867926c7503e7c587e86c67896a9e7347600447b /src/purgatory/sync/throttle.rs
parent3f14f998d64b5fa15bdddd7570b4f72874eb9f29 (diff)
chore: cargo fmt
Diffstat (limited to 'src/purgatory/sync/throttle.rs')
-rw-r--r--src/purgatory/sync/throttle.rs31
1 files changed, 13 insertions, 18 deletions
diff --git a/src/purgatory/sync/throttle.rs b/src/purgatory/sync/throttle.rs
index e6efe1f..ad6e8ea 100644
--- a/src/purgatory/sync/throttle.rs
+++ b/src/purgatory/sync/throttle.rs
@@ -316,15 +316,13 @@ impl ThrottleManager {
316 } 316 }
317 317
318 // Create new throttle 318 // Create new throttle
319 self.throttles 319 self.throttles.entry(domain.to_string()).or_insert_with(|| {
320 .entry(domain.to_string()) 320 Mutex::new(DomainThrottle::new(
321 .or_insert_with(|| { 321 domain.to_string(),
322 Mutex::new(DomainThrottle::new( 322 self.max_concurrent_per_domain,
323 domain.to_string(), 323 self.max_per_minute_per_domain,
324 self.max_concurrent_per_domain, 324 ))
325 self.max_per_minute_per_domain, 325 });
326 ))
327 });
328 326
329 // Return the entry (we know it exists now) 327 // Return the entry (we know it exists now)
330 self.throttles.get(domain).unwrap() 328 self.throttles.get(domain).unwrap()
@@ -438,7 +436,9 @@ impl ThrottleManager {
438 let domain = domain.to_string(); 436 let domain = domain.to_string();
439 437
440 tokio::spawn(async move { 438 tokio::spawn(async move {
441 manager.process_queued_identifier(&domain, &identifier).await; 439 manager
440 .process_queued_identifier(&domain, &identifier)
441 .await;
442 }); 442 });
443 } 443 }
444 } 444 }
@@ -480,14 +480,9 @@ impl ThrottleManager {
480 }; 480 };
481 481
482 // Get next URL for this identifier on this specific domain 482 // Get next URL for this identifier on this specific domain
483 let url = sync_identifier_next_url( 483 let url =
484 ctx.as_ref(), 484 sync_identifier_next_url(ctx.as_ref(), identifier, Some(domain), &tried_urls, self)
485 identifier, 485 .await;
486 Some(domain),
487 &tried_urls,
488 self,
489 )
490 .await;
491 486
492 match url { 487 match url {
493 Some(url) => { 488 Some(url) => {