From d546caa3f5053ade763430490911fefd6257af9f Mon Sep 17 00:00:00 2001 From: metamuffin Date: Sat, 30 Sep 2023 22:19:19 +0200 Subject: make cache async and fix parallel write bug --- client/src/lib.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'client/src') diff --git a/client/src/lib.rs b/client/src/lib.rs index 200c869..92545a9 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -12,6 +12,7 @@ use reqwest::{ use serde_json::json; use std::time::Duration; use stream::StreamSpec; +use tokio::io::AsyncWriteExt; pub use jellycommon::*; @@ -93,7 +94,7 @@ impl Session { &self, id: &str, role: &str, - mut writer: impl std::io::Write, + mut writer: impl tokio::io::AsyncWrite + std::marker::Unpin, ) -> Result<()> { debug!("downloading asset {role:?} for {id:?}"); let mut r = self @@ -102,7 +103,7 @@ impl Session { .send() .await?; while let Some(chunk) = r.chunk().await? { - writer.write_all(&chunk)?; + writer.write_all(&chunk).await?; } Ok(()) } -- cgit v1.2.3-70-g09d2