Skip to content

Commit

Permalink
feat: streamline summary retrieval by replacing Mutex unwrapping with…
Browse files Browse the repository at this point in the history
… retrieve_from_arc_mutex

Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>
  • Loading branch information
simonsan committed Nov 25, 2024
1 parent ce08470 commit a2aee81
Showing 1 changed file with 2 additions and 20 deletions.
22 changes: 2 additions & 20 deletions crates/core/src/commands/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,16 +361,7 @@ pub(crate) fn check_repository<P: ProgressBars, S: Open>(
p.finish();
}

let mut summary = Arc::try_unwrap(summary)
.map_err(|_err| RusticError::new(ErrorKind::Internal, "Error unwrapping Mutex from Arc."))?
.into_inner()
.map_err(|err| {
RusticError::with_source(
ErrorKind::Internal,
"Mutex poisoned while getting summary for check command.",
err,
)
})?;
let mut summary = Summary::retrieve_from_arc_mutex(summary)?;

summary.complete();

Expand Down Expand Up @@ -507,16 +498,7 @@ fn check_cache_files(

p.finish();

let mut summary = Arc::try_unwrap(summary)
.map_err(|_err| RusticError::new(ErrorKind::Internal, "Error unwrapping Mutex from Arc."))?
.into_inner()
.map_err(|err| {
RusticError::with_source(
ErrorKind::Internal,
"Mutex poisoned while getting summary for check command.",
err,
)
})?;
let mut summary = Summary::retrieve_from_arc_mutex(summary)?;

summary.complete();

Expand Down

0 comments on commit a2aee81

Please sign in to comment.