Skip to content

Commit

Permalink
Do not store in plot cache pieces that are already in piece cache
Browse files Browse the repository at this point in the history
  • Loading branch information
nazar-pc committed Mar 1, 2024
1 parent a42fbbc commit 3f1114f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crates/subspace-farmer/src/farmer_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -886,10 +886,18 @@ impl FarmerCache {

let should_store_fut = tokio::task::spawn_blocking({
let plot_caches = Arc::clone(&self.plot_caches);
let piece_caches = Arc::clone(&self.piece_caches);
let next_plot_cache = Arc::clone(&self.next_plot_cache);
let piece = piece.clone();

move || {
for cache in piece_caches.read().iter() {
if cache.stored_pieces.contains_key(&key) {
// Already stored in normal piece cache, no need to store it again
return;
};
}

let plot_caches = plot_caches.read();
let plot_caches_len = plot_caches.len();

Expand Down

0 comments on commit 3f1114f

Please sign in to comment.