Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## 2026-06-09

- Bump `save` crate version to `0.2.6`.
- Bump `save-dweb-backend` dependency to `v0.3.9`.
- Defer media body downloads during refresh so file metadata remains available when large media transfers are slow or fail.
- Return an empty media list for empty repositories instead of surfacing a DHT root-hash error.

## 2026-05-31

- Bump `save` crate version to `0.2.5`.
Expand Down
35 changes: 18 additions & 17 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "save"
version = "0.2.5"
version = "0.2.6"
description = "Decentralized Web for Save"
edition = "2021"
publish = false
Expand All @@ -27,7 +27,7 @@ ios = []
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
save-dweb-backend = { git = "https://github.com/OpenArchive/save-dweb-backend", tag = "v0.3.7" }
save-dweb-backend = { git = "https://github.com/OpenArchive/save-dweb-backend", tag = "v0.3.9" }
tokio = { version = "^1.43", default-features = false, features = ["rt", "rt-multi-thread", "sync", "time", "macros"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
Expand Down
52 changes: 11 additions & 41 deletions src/groups.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ async fn refresh_group(group_id: web::Path<String>) -> AppResult<impl Responder>
"refreshed_files": json!(Vec::<String>::new()), // Initialize empty
"all_files": json!(Vec::<String>::new()) // Initialize empty
});
let mut refreshed_files_vec = Vec::new();
let mut all_files_vec: Vec<String> = Vec::new();

if repo.can_write() {
Expand Down Expand Up @@ -292,46 +291,17 @@ async fn refresh_group(group_id: web::Path<String>) -> AppResult<impl Responder>
};
repo_info["all_files"] = json!(all_files_vec.clone());

// For each file, check if it needs to be refreshed
for file_name in &all_files_vec {
match repo.get_file_hash(file_name).await {
Ok(file_hash) => {
if !group.has_hash(&file_hash).await? {
log_debug!(
TAG,
"File {} hash {} not found locally. Downloading...",
file_name,
file_hash
);
match group.download_hash_from_peers(&file_hash).await {
Ok(_) => {
log_debug!(
TAG,
"Successfully downloaded file hash {} for {}",
file_hash,
file_name
);
refreshed_files_vec.push(file_name.clone());
}
Err(e) => {
log_debug!(
TAG,
"Error downloading file {} hash {}: {}",
file_name,
file_hash,
e
);
// Optionally add to a list of files that failed to download
}
}
}
}
Err(e) => {
log_debug!(TAG, "Error getting hash for file {}: {}", file_name, e);
}
}
}
repo_info["refreshed_files"] = json!(refreshed_files_vec);
// Keep refresh metadata-only. Downloading every missing file body here
// can block later file discovery behind one slow or failing transfer.
// `refreshed_files` is retained for API compatibility; file bodies are
// now refreshed only by the explicit media endpoints.
log_debug!(
TAG,
"Repo {} refresh discovered {} files; body downloads are deferred to media endpoint.",
repo.id(),
all_files_vec.len()
);
repo_info["refreshed_files"] = json!(Vec::<String>::new());
}
Ok(Err(e)) => {
log_debug!(TAG, "Error getting repo hash for {}: {}", repo.id(), e);
Expand Down
Loading
Loading