feat(downloads): Separated chunk updates into individual counters

Also added a From<bool> for DownloadThreadControlFlag because I accidentally was calling the wrong one before and had meant to add it anyway

Signed-off-by: quexeky <git@quexeky.dev>
This commit is contained in:
quexeky
2024-11-11 18:07:45 +11:00
parent 5e05e6873d
commit 7d3c6011df
7 changed files with 68 additions and 36 deletions

View File

@ -1,4 +1,4 @@
use std::sync::{Arc, Mutex};
use std::sync::{atomic::Ordering, Arc, Mutex};
use log::info;
use rayon::spawn;
@ -39,14 +39,8 @@ pub fn get_game_download_progress(
let da = use_download_agent(state, game_id)?;
let progress = &da.progress;
let current: f64 = progress
.current
.fetch_add(0, std::sync::atomic::Ordering::Relaxed) as f64;
let max = progress.max as f64;
let current_progress = current / max;
Ok(current_progress)
Ok(progress.get_progress())
}
fn use_download_agent(