better download defaults

This commit is contained in:
DecDuck
2024-10-24 22:17:50 +11:00
parent 5ed0833e61
commit 4779383fc9
2 changed files with 4 additions and 4 deletions

View File

@ -34,7 +34,8 @@ pub fn download_game_chunk(ctx: DropDownloadContext) {
.expect("Failed to seek to file offset"); .expect("Failed to seek to file offset");
} }
let mut stream = BufWriter::with_capacity(1024, file_lock.try_clone().unwrap()); let mut stream = BufWriter::with_capacity(1024 * 1024, file_lock.try_clone().unwrap());
drop(file_lock);
response.copy_to(&mut stream).unwrap(); response.copy_to(&mut stream).unwrap();
} }

View File

@ -64,6 +64,7 @@ impl GameDownloadManager {
} }
self.ensure_manifest_exists().await self.ensure_manifest_exists().await
} }
pub fn begin_download( pub fn begin_download(
&self, &self,
max_threads: usize, max_threads: usize,
@ -76,6 +77,7 @@ impl GameDownloadManager {
progress.run_contexts_parallel(contexts, max_threads); progress.run_contexts_parallel(contexts, max_threads);
Ok(()) Ok(())
} }
pub async fn ensure_manifest_exists(&self) -> Result<(), GameDownloadError> { pub async fn ensure_manifest_exists(&self) -> Result<(), GameDownloadError> {
if self.manifest.lock().unwrap().is_some() { if self.manifest.lock().unwrap().is_some() {
return Ok(()); return Ok(());
@ -145,9 +147,6 @@ pub fn generate_job_contexts(
let mut running_offset = 0; let mut running_offset = 0;
for i in 0..chunk.ids.len() { for i in 0..chunk.ids.len() {
if i == 1 {
info!("woah a chunk bigger than 1")
}
contexts.push(DropDownloadContext { contexts.push(DropDownloadContext {
file_name: raw_path.to_string(), file_name: raw_path.to_string(),
version: version.to_string(), version: version.to_string(),