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
5 changes: 5 additions & 0 deletions .changeset/bundle_largest_files_first.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
default: patch
---

# Bundle updates download the largest files first so they finish sooner
7 changes: 6 additions & 1 deletion packages/oneclient_content/src/bundles/updates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -536,12 +536,17 @@ pub async fn apply_bundle_updates_with(
s.expect(oneclient_events::TaskCategory::Packages, count, bytes);
}

let to_fetch: Vec<BundleFile> = check
let mut to_fetch: Vec<BundleFile> = check
.updates_available
.iter()
.map(|u| u.new_file.clone())
.chain(check.additions_available.iter().map(|a| a.new_file.clone()))
.collect();
// Largest first. Six fetches run at once and the phase waits for the last
// one, so a large file that starts late becomes a tail the small ones have
// already finished in front of. Started first, it overlaps them instead,
// and it also gets in before `deadline` stops new fetches from starting.
to_fetch.sort_by_key(|file| std::cmp::Reverse(file.size));
let fetched = futures_util::stream::iter(to_fetch.into_iter().map(|file| async move {
if past(deadline) {
return (file, None);
Expand Down
Loading