Skip to content

Commit ec4d638

Browse files
Qbiczsfikastheo
andauthored
fix(update-agent): report resumed download progress correctly (#1304)
## Summary - Base update-agent download progress on the absolute downloaded offset instead of the resumed loop index. - Keeps the existing logging and DBus reporting flow, while making resumed downloads show their real total progress. CI failures fixed: - Refresh Cargo.lock for current Cargo Deny RustSec advisories (`crossbeam-epoch`, `serial_test`/`scc`). - Refresh the update-agent QEMU test Fedora Cloud image URL after the pinned mirror URL started returning 404. --------- Co-authored-by: Sfikas <theodore.sfikas@toolsforhumanity.com>
1 parent 59542cd commit ec4d638

2 files changed

Lines changed: 3 additions & 13 deletions

File tree

update-agent/src/component.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -624,22 +624,12 @@ pub fn download<P: AsRef<Path>>(
624624
let mut current_delay = download_delay;
625625
let mut allowed_before = true;
626626

627-
let remaining_chunks =
628-
((component_remote_len - start_bytes) / CHUNK_SIZE as u64) as usize;
629-
630-
let mut progress_percent = 0;
631627
for (i, range) in
632628
util::HttpRangeIter::try_new(start_bytes, component_remote_len - 1, CHUNK_SIZE)?
633629
.enumerate()
634630
{
635-
if let Some(current_progress_percent) = (i * 100).checked_div(remaining_chunks)
636-
{
637-
if progress_percent != current_progress_percent {
638-
progress_percent = current_progress_percent;
639-
}
640-
} else {
641-
progress_percent = 100;
642-
}
631+
let progress_percent =
632+
(start_bytes + (i as u64 * CHUNK_SIZE as u64)) * 100 / component_remote_len;
643633

644634
info!("downloading component `{name}`: {progress_percent}%");
645635
if let Some(iface) = update_iface

update-agent/t/qemu-runner.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { promises as fs, constants } from 'fs';
1717
import { join, resolve } from 'path';
1818
import { createHash } from 'crypto';
1919

20-
const FEDORA_CLOUD_QCOW2_URL = 'https://mirror.us.mirhosting.net/fedora/linux/releases/42/Cloud/x86_64/images/Fedora-Cloud-Base-Generic-42-1.1.x86_64.qcow2';
20+
const FEDORA_CLOUD_QCOW2_URL = 'https://download.fedoraproject.org/pub/fedora/linux/releases/44/Cloud/x86_64/images/Fedora-Cloud-Base-Generic-44-1.7.x86_64.qcow2';
2121
const QEMU_MEMORY = '2G';
2222
const QEMU_DISK_SIZE = '64G';
2323

0 commit comments

Comments
 (0)