summaryrefslogtreecommitdiff
path: root/client/src/download.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-01-12 01:12:34 +0100
committermetamuffin <metamuffin@disroot.org>2025-01-12 01:12:34 +0100
commita3e3b724d4fe97f251e830197527f3a106b0a890 (patch)
tree697e639b901721141a1b150361d63dadd1672f74 /client/src/download.rs
parent4cba9ed9b8fb4d3f349ee6b1a17068ed21709008 (diff)
downloadweareserver-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.rs5
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)