Skip to content

Commit

Permalink
Make piece cache retrieval concurrency unaffected by piece retrieval …
Browse files Browse the repository at this point in the history
…success
  • Loading branch information
nazar-pc committed Nov 19, 2023
1 parent f54777f commit 36f334e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions crates/subspace-farmer/src/piece_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,11 @@ where
let mut downloaded_pieces_count = 0;
self.handlers.progress.call_simple(&0.0);
while let Some(maybe_piece) = downloading_pieces.next().await {
// Push another piece to download
if let Some(piece_index_to_download) = piece_indices_to_store.next() {
downloading_pieces.push(download_piece(piece_index_to_download));
}

let Some((piece_index, piece)) = maybe_piece else {
continue;
};
Expand Down Expand Up @@ -365,11 +370,6 @@ where
info!("Piece cache sync {progress:.2}% complete");
self.handlers.progress.call_simple(&progress);
}

// Push another piece to download
if let Some(piece_index_to_download) = piece_indices_to_store.next() {
downloading_pieces.push(download_piece(piece_index_to_download));
}
}

*self.caches.write() = caches;
Expand Down

0 comments on commit 36f334e

Please sign in to comment.