fix: implement aria2 polling to prevent UI from sticking on queued

This commit is contained in:
NimBold
2026-06-15 17:51:32 +03:30
parent 58f0f0dfb1
commit 601b04c4cb
2 changed files with 83 additions and 5 deletions
+3 -3
View File
@@ -577,7 +577,7 @@ fn build_client(payload: &DownloadPayload) -> Result<Client, String> {
builder.build().map_err(|error| error.to_string())
}
fn format_speed(bytes_per_second: f64) -> String {
pub(crate) fn format_speed(bytes_per_second: f64) -> String {
if bytes_per_second >= 1024.0 * 1024.0 {
format!("{:.1} MB/s", bytes_per_second / (1024.0 * 1024.0))
} else if bytes_per_second >= 1024.0 {
@@ -587,7 +587,7 @@ fn format_speed(bytes_per_second: f64) -> String {
}
}
fn format_size(bytes: f64) -> String {
pub(crate) fn format_size(bytes: f64) -> String {
if bytes >= 1024.0 * 1024.0 * 1024.0 {
format!("{:.2} GB", bytes / (1024.0 * 1024.0 * 1024.0))
} else if bytes >= 1024.0 * 1024.0 {
@@ -599,7 +599,7 @@ fn format_size(bytes: f64) -> String {
}
}
fn format_duration(seconds: f64) -> String {
pub(crate) fn format_duration(seconds: f64) -> String {
if seconds >= 3600.0 {
format!("{:.0}h {:.0}m", seconds / 3600.0, (seconds % 3600.0) / 60.0)
} else if seconds >= 60.0 {