mirror of
https://github.com/Drop-OSS/drop-app.git
synced 2025-11-13 16:22:43 +10:00
better download defaults
This commit is contained in:
@ -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();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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(),
|
||||||
|
|||||||
Reference in New Issue
Block a user