aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--server/src/routes/ui/assets.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/server/src/routes/ui/assets.rs b/server/src/routes/ui/assets.rs
index f2c3f3f..eae1b9b 100644
--- a/server/src/routes/ui/assets.rs
+++ b/server/src/routes/ui/assets.rs
@@ -8,6 +8,7 @@ use crate::{
routes::ui::{account::session::Session, error::MyError, CacheControlFile},
};
use anyhow::anyhow;
+use async_std::task::spawn_blocking;
use jellycommon::AssetLocation;
use log::info;
use rocket::{get, http::ContentType, FromFormField, State, UriDisplayQuery};
@@ -49,7 +50,8 @@ pub async fn r_item_assets(
));
// fit the resolution into a finite set so the maximum cache is finite too.
let width = 2usize.pow(width.unwrap_or(2048).clamp(128, 8196).ilog2());
- let path = jellytranscoder::image::transcode(asset, 50., 5, width)?;
+ let path =
+ spawn_blocking(move || jellytranscoder::image::transcode(asset, 50., 5, width)).await?;
info!("loading asset from {path:?}");
Ok((
ContentType::AVIF,