Downloading chunks now does not copy the chunks, but writes them straight to disk. (Still reads into a buffer first though, but does not allocate on every chunk)
This commit is contained in:
parent
fab43a8d23
commit
14b62b45c5
7 changed files with 96 additions and 109 deletions
|
|
@ -18,20 +18,3 @@ pub fn spawn<N: Display + 'static + Send>(
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
pub fn spawn_blocking<T: Send + Sync + 'static, N: Display + 'static + Send>(
|
||||
name: N,
|
||||
f: impl FnOnce() -> anyhow::Result<T> + Send + 'static,
|
||||
) -> tokio::task::JoinHandle<anyhow::Result<T>> {
|
||||
debug!("starting blocking task \"{}\"", name);
|
||||
tokio::task::spawn_blocking(move || match f() {
|
||||
Ok(v) => {
|
||||
debug!("blocking task \"{}\" finished", name);
|
||||
Ok(v)
|
||||
}
|
||||
Err(e) => {
|
||||
error!("error in blocking task \"{}\": {:#}", name, &e);
|
||||
Err(e)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue