From 7bfbe3b1fe514db0d2357433abf780090b5fa79b Mon Sep 17 00:00:00 2001 From: minish Date: Mon, 27 May 2024 11:42:05 -0400 Subject: [PATCH] fix disk saving bug --- src/engine.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/engine.rs b/src/engine.rs index 9aff250..d739c75 100644 --- a/src/engine.rs +++ b/src/engine.rs @@ -185,8 +185,6 @@ impl Engine { None }; - let tx: Option<&_> = tx.as_ref(); - // whether or not we're gonna coalesce the data // in order to strip the exif data at the end, // instead of just sending it off to the i/o task @@ -209,7 +207,9 @@ impl Engine { // also cloning this is okay because it's a Bytes if !coalesce_and_strip { debug!("sending chunk to i/o task"); - tx.map(|tx| tx.send(chunk.clone())); + if let Some(ref tx) = tx { + let _ = tx.send(chunk.clone()).await; + } } if use_cache { @@ -240,14 +240,18 @@ impl Engine { img.encoder().bytes() }) }) { - debug!("stripped exif data"); + info!("stripped exif data"); data } else { + info!("failed to strip exif data"); data }; // send what we did over to the i/o task, all in one chunk - tx.map(|tx| tx.send(data.clone())); + debug!("sending filled buffer to i/o task"); + if let Some(ref tx) = tx { + let _ = tx.send(data.clone()).await; + } data } else {