From c13ebb9065b61a99dd31f317bf39b262784a3b45 Mon Sep 17 00:00:00 2001 From: hanabi1224 Date: Thu, 16 Mar 2023 23:32:11 +0800 Subject: [PATCH] fix reachable_bytes calculation --- node/db/src/rolling/gc.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/node/db/src/rolling/gc.rs b/node/db/src/rolling/gc.rs index 9728f50395af..86d68e1d83ef 100644 --- a/node/db/src/rolling/gc.rs +++ b/node/db/src/rolling/gc.rs @@ -199,10 +199,10 @@ where let block = db .get(&cid)? .ok_or_else(|| anyhow::anyhow!("Cid {cid} not found in blockstore"))?; + + let pair = (cid.to_bytes(), block.clone()); + reachable_bytes.fetch_add(pair.0.len() + pair.1.len(), atomic::Ordering::Relaxed); if !db.current().has(&cid)? { - let pair = (cid.to_bytes(), block.clone()); - reachable_bytes - .fetch_add(pair.0.len() + pair.1.len(), atomic::Ordering::Relaxed); tx.send_async(pair).await?; }