Fix caching message when cache is disabled

This commit is contained in:
Roderick van Domburg 2021-12-18 14:02:28 +01:00
parent 9d88ac59c6
commit d18a0d1803
No known key found for this signature in database
GPG key ID: A9EF5222A26F0451
2 changed files with 7 additions and 5 deletions

View file

@ -310,10 +310,12 @@ impl AudioFile {
let session_ = session.clone();
session.spawn(complete_rx.map_ok(move |mut file| {
if let Some(cache) = session_.cache() {
debug!("File {} complete, saving to cache", file_id);
if cache.file_path(file_id).is_some() {
cache.save_file(file_id, &mut file);
} else {
debug!("File {} complete", file_id);
debug!("File {} cached to {:?}", file_id, cache.file(file_id));
}
debug!("Downloading file {} complete", file_id);
}
}));

View file

@ -350,7 +350,7 @@ impl Cache {
}
}
fn file_path(&self, file: FileId) -> Option<PathBuf> {
pub fn file_path(&self, file: FileId) -> Option<PathBuf> {
self.audio_location.as_ref().map(|location| {
let name = file.to_base16();
let mut path = location.join(&name[0..2]);