From 43039e0a42ddfa368dc8cc37e399ffb16d96349d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20P=C3=A4iv=C3=A4rinta?= Date: Wed, 14 Jun 2023 01:22:08 +0200 Subject: [PATCH] Separate redirect history for each worker --- CHANGELOG.md | 1 + src/main.rs | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f427e3..69f10ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning]. ## [Unreleased] ### Fixed - Fix connection errors with domains resolved to IPv6 addresses. +- Workers no longer dirty each other's redirect histories. ### Added - New --link-only flag ([#30], courtesy of [@egrieco]). diff --git a/src/main.rs b/src/main.rs index a7680a4..6bc03a5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -183,14 +183,14 @@ fn main() { let prefixes: Vec<_> = opt.prefixes.iter().map(AsRef::as_ref).collect(); let resolver = FragResolver::from(&prefixes); - let client = if opt.check { + let make_client = if opt.check { if opt.redirect { - Some(Client::new_follow()) + || Some(Client::new_follow()) } else { - Some(Client::new_no_follow()) + || Some(Client::new_no_follow()) } } else { - None + || None }; let o = Orderer { @@ -244,7 +244,7 @@ fn main() { .fold(HashMap::new(), group_fragments) .into_par_iter() .flat_map(|(base, fragments)| { - let document = client + let document = make_client() .as_ref() .map(|client| client.fetch_link(opt.urldecode, &base));