Skip to content

Commit a4bb098

Browse files
committed
Use new reset method to reset digests cache in client
1 parent 4378503 commit a4bb098

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

mithril-client/src/commands/restore.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ impl RestoreCommand {
6262
self.disable_digests_cache,
6363
self.reset_digests_cache,
6464
&config,
65-
)?,
65+
)
66+
.await?,
6667
slog_scope::logger(),
6768
));
6869
let output = runtime
@@ -92,7 +93,7 @@ docker run -v cardano-node-ipc:/ipc -v cardano-node-data:/data --mount type=bind
9293
}
9394
}
9495

95-
fn build_digester_cache_provider(
96+
async fn build_digester_cache_provider(
9697
disable_digests_cache: bool,
9798
reset_digests_cache: bool,
9899
config: &Config,
@@ -119,9 +120,10 @@ fn build_digester_cache_provider(
119120
}
120121

121122
let cache_file = cache_dir.join(format!("immutables_digests_{}.json", config.network));
123+
let cache_provider = Arc::new(JsonImmutableFileDigestCacheProvider::new(&cache_file));
122124

123125
if reset_digests_cache {
124-
fs::remove_file(&cache_file).map_err(|e| {
126+
cache_provider.reset().await.map_err(|e| {
125127
format!(
126128
"Failure when resetting digests cache file `{}`: {}",
127129
cache_file.display(),
@@ -134,9 +136,7 @@ fn build_digester_cache_provider(
134136
"Storing/Getting immutables digests cache from: {}",
135137
cache_file.display()
136138
);
137-
Ok(Some(Arc::new(JsonImmutableFileDigestCacheProvider::new(
138-
&cache_file,
139-
))))
139+
Ok(Some(cache_provider))
140140
}
141141
}
142142
}

0 commit comments

Comments
 (0)