From a123a1997f3ab527ab83b44ca18bec94883f46d0 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Fri, 18 Apr 2025 23:33:29 +0200 Subject: use impl Hash for cache key instead of string --- server/src/routes/ui/admin/mod.rs | 2 +- server/src/routes/ui/assets.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'server/src') diff --git a/server/src/routes/ui/admin/mod.rs b/server/src/routes/ui/admin/mod.rs index 15cc5c0..f44b36c 100644 --- a/server/src/routes/ui/admin/mod.rs +++ b/server/src/routes/ui/admin/mod.rs @@ -225,7 +225,7 @@ pub async fn r_admin_transcode_posters( continue; } let source = resolve_asset(asset).await.context("resolving asset")?; - jellytranscoder::image::transcode(source, AVIF_QUALITY, AVIF_SPEED, 1024) + jellytranscoder::image::transcode(&source, AVIF_QUALITY, AVIF_SPEED, 1024) .await .context("transcoding asset")?; } diff --git a/server/src/routes/ui/assets.rs b/server/src/routes/ui/assets.rs index cfaa68e..c661771 100644 --- a/server/src/routes/ui/assets.rs +++ b/server/src/routes/ui/assets.rs @@ -31,7 +31,7 @@ pub async fn r_asset( let session = fed.get_session(&host).await?; let asset = base64::engine::general_purpose::URL_SAFE.encode(asset); - async_cache_file(&["fed-asset", &asset], |out| async { + async_cache_file("fed-asset", &asset, |out| async { session.asset(out, &asset, width).await }) .await? @@ -40,7 +40,7 @@ pub async fn r_asset( // fit the resolution into a finite set so the maximum cache is finite too. let width = 2usize.pow(width.clamp(128, 2048).ilog2()); - jellytranscoder::image::transcode(source, AVIF_QUALITY, AVIF_SPEED, width) + jellytranscoder::image::transcode(&source, AVIF_QUALITY, AVIF_SPEED, width) .await .context("transcoding asset")? }; @@ -186,7 +186,7 @@ pub async fn r_node_thumbnail( ) .await?; - async_cache_file(&["fed-thumb", &format!("{id} {t}")], |out| { + async_cache_file("fed-thumb", (id, t as i64), |out| { session.node_thumbnail(out, id.into(), 2048, t) }) .await? -- cgit v1.2.3-70-g09d2