From a3e3b724d4fe97f251e830197527f3a106b0a890 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Sun, 12 Jan 2025 01:12:34 +0100 Subject: enable persistant cache + print timing info --- client/src/download.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'client/src/download.rs') diff --git a/client/src/download.rs b/client/src/download.rs index bc3de09..85cce32 100644 --- a/client/src/download.rs +++ b/client/src/download.rs @@ -55,6 +55,11 @@ impl Downloader { let mut state = self.inner.write().unwrap(); if state.have.contains(&hash) { state.store.get_raw(hash) + } else if state.need.contains(&hash) { + Ok(None) + } else if let Some(res) = state.store.get_raw(hash)? { + state.have.insert(hash); + Ok(Some(res)) } else { state.need.insert(hash); Ok(None) -- cgit v1.2.3-70-g09d2