Skip to content

Commit 5d2fa8e

Browse files
committed
Keep track of which store paths we've already handled
1 parent f5d0521 commit 5d2fa8e

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎src/event_loop.rs‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use core::pin::pin;
2+
use std::collections::HashSet;
23

34
use futures::stream::{FusedStream, FuturesUnordered};
45
use futures::{AsyncRead, AsyncWrite, StreamExt, select};
@@ -80,6 +81,7 @@ pub(crate) async fn run<Ctx: Context>(
8081

8182
let mut store_closures = FuturesUnordered::new();
8283
let mut handle_store_paths = FuturesUnordered::new();
84+
let mut handled_store_hashes = HashSet::new();
8385

8486
let mut report = ActionReport::<Ctx>::default();
8587

@@ -107,6 +109,10 @@ pub(crate) async fn run<Ctx: Context>(
107109
match closure_res {
108110
Ok(store_paths) => {
109111
for path in store_paths {
112+
// Skip this path if it's already been handled.
113+
if handled_store_hashes.contains(path.hash()) {
114+
continue;
115+
}
110116
let cache = cache.clone();
111117
let nix = ctx.nix().clone();
112118
let fut = async move {
@@ -122,6 +128,7 @@ pub(crate) async fn run<Ctx: Context>(
122128
}
123129
},
124130
(result, path) = handle_store_paths.select_next_some() => {
131+
handled_store_hashes.insert(*path.hash());
125132
match result {
126133
Ok(outcome) => outcome.update_report(&mut report),
127134
Err(err) => report.path_handling_errors.push((path, err)),

0 commit comments

Comments
 (0)