Skip to content

Commit

Permalink
feat: simplify summary initialization by removing Mutex and using int…
Browse files Browse the repository at this point in the history
…o_arc_mutex

Signed-off-by: simonsan <[email protected]>
  • Loading branch information
simonsan committed Nov 25, 2024
1 parent 2c71c83 commit 6bd5041
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions crates/core/src/commands/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::{
fmt::Debug,
num::ParseIntError,
str::FromStr,
sync::{Arc, Mutex},
sync::Arc,
};

use bytes::Bytes;
Expand Down Expand Up @@ -242,7 +242,7 @@ pub(crate) fn check_repository<P: ProgressBars, S: Open>(
opts: CheckOptions,
trees: Vec<TreeId>,
) -> RusticResult<Summary> {
let summary = Arc::new(Mutex::new(Summary::new("check")));
let summary = Summary::new("check").into_arc_mutex();
let be = repo.dbe();
let cache = repo.cache();
let hot_be = &repo.be_hot;
Expand Down Expand Up @@ -459,7 +459,7 @@ fn check_cache_files(
file_type: FileType,
p: &impl Progress,
) -> RusticResult<Option<Summary>> {
let summary = Arc::new(Mutex::new(Summary::new("cache files").enable_log()));
let summary = Summary::new("cache files").enable_log().into_arc_mutex();
let files = cache.list_with_size(file_type)?;

if files.is_empty() {
Expand Down Expand Up @@ -744,7 +744,7 @@ fn check_trees(
snap_trees: Vec<TreeId>,
pb: &impl ProgressBars,
) -> RusticResult<(BTreeSet<PackId>, Summary)> {
let mut summary = Box::new(Summary::new("trees").enable_log());
let mut summary = Summary::new("trees").enable_log().into_boxed();
let mut packs = BTreeSet::new();
let p = pb.progress_counter("checking trees...");
let mut tree_streamer = TreeStreamerOnce::new(be, index, snap_trees, p)?;
Expand Down

0 comments on commit 6bd5041

Please sign in to comment.