call drop() early

This commit is contained in:
monosans
2025-08-15 17:19:50 +03:00
parent 88cef31072
commit 690f0f33db
4 changed files with 13 additions and 0 deletions
+4
View File
@@ -72,6 +72,10 @@ pub async fn check_all<R: reqwest::dns::Resolve + 'static>(
}
drop(queue);
drop(config);
drop(dns_resolver);
drop(token);
drop(tx);
while let Some(res) = join_set.join_next().await {
match res {
+1
View File
@@ -49,6 +49,7 @@ impl reqwest::dns::Resolve for HickoryDnsResolver {
let resolver = Arc::clone(&self.0);
Box::pin(async move {
let lookup = resolver.lookup_ip(name.as_str()).await?;
drop(resolver);
let addrs: reqwest::dns::Addrs = Box::new(
lookup.into_iter().map(|ip_addr| SocketAddr::new(ip_addr, 0)),
);
+1
View File
@@ -196,6 +196,7 @@ impl DbType {
db_path.display()
);
}
drop(db_path);
if let Some(etag_value) = etag {
self.save_etag(etag_value).await.wrap_err_with(move || {
+7
View File
@@ -156,11 +156,18 @@ pub async fn scrape_all(
}
}
drop(config);
drop(http_client);
drop(token);
drop(tx);
while let Some(res) = join_set.join_next().await {
res.wrap_err("proxy scraping task panicked or was cancelled")?
.wrap_err("proxy scraping task failed")?;
}
drop(join_set);
Ok(Arc::into_inner(proxies)
.ok_or_eyre("failed to unwrap Arc")?
.into_inner()