diff options
author | metamuffin <metamuffin@disroot.org> | 2025-01-12 01:12:34 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-01-12 01:12:34 +0100 |
commit | a3e3b724d4fe97f251e830197527f3a106b0a890 (patch) | |
tree | 697e639b901721141a1b150361d63dadd1672f74 /client/src/download.rs | |
parent | 4cba9ed9b8fb4d3f349ee6b1a17068ed21709008 (diff) | |
download | weareserver-a3e3b724d4fe97f251e830197527f3a106b0a890.tar weareserver-a3e3b724d4fe97f251e830197527f3a106b0a890.tar.bz2 weareserver-a3e3b724d4fe97f251e830197527f3a106b0a890.tar.zst |
enable persistant cache + print timing info
Diffstat (limited to 'client/src/download.rs')
-rw-r--r-- | client/src/download.rs | 5 |
1 files changed, 5 insertions, 0 deletions
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) |