diff options
Diffstat (limited to 'transcoder/src/image.rs')
-rw-r--r-- | transcoder/src/image.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/transcoder/src/image.rs b/transcoder/src/image.rs index 06a2f80..3cd9986 100644 --- a/transcoder/src/image.rs +++ b/transcoder/src/image.rs @@ -1,3 +1,4 @@ +use crate::LOCAL_TRANSCODING_TASKS; use anyhow::Context; use image::{imageops::FilterType, ImageFormat}; use jellybase::{cache::async_cache_file, AssetLocationExt}; @@ -22,11 +23,10 @@ pub async fn transcode( &format!("{width} {quality} {speed}"), ], move |mut output| async move { + let _permit = LOCAL_TRANSCODING_TASKS.acquire().await?; + info!("encoding {asset:?} (speed={speed}, quality={quality}, width={width})"); let encoded = tokio::task::spawn_blocking(move || { let original_path = asset.path(); - info!( - "encoding {original_path:?} (speed={speed}, quality={quality}, width={width})" - ); // TODO shouldn't be neccessary with guessed format. let file = BufReader::new(File::open(&original_path).context("opening source")?); let mut reader = image::io::Reader::new(file); |