deps: update esbuild to 0.27.4, rollup to 4.60.0, vite to 7.3.1
deps: update esbuild to 0.27.4, rollup to 4.60.0, vite to 7.3.1 - bump esbuild and all platform-specific binaries from 0.25.10 to 0.27.4 - bump rollup and all platform-specific binaries from 4.52.3 to 4.60.0 - bump vite from 7.1.7 to 7.3.1 (esbuild peer dep updated to ^0.27.0) - bump dompurify from 3.2.7 to 3.3.3 web: improve cover image retry logic - increase maxRetries default from 3 to 5 - reduce initial retryDelay from 1000ms to 500ms - implement exponential backoff: delay = retryDelay * 2^(retryCount - 1) - add detailed logging for retries and final failure rust: minor cleanup - remove unused imports (watch, Url, AudioSegment, SyncMarker) - add tracing debug logs for cache file requests - handle missing files gracefully with warning + client retry hint - add #[allow(async_fn_in_trait)] where needed
This commit is contained in:
@@ -9,6 +9,7 @@ use crate::{cache::is_lazy_pk, CacheConfig, DB};
|
||||
/// Trait générique pour les caches de fichiers
|
||||
///
|
||||
/// Définit l'interface commune pour tous les types de caches (images, audio, etc.)
|
||||
#[allow(async_fn_in_trait)]
|
||||
pub trait FileCache<C: CacheConfig>: Send + Sync {
|
||||
fn get_cache_dir(&self) -> &Path;
|
||||
fn get_database(&self) -> Arc<DB>;
|
||||
|
||||
@@ -92,9 +92,17 @@ async fn get_file<C: CacheConfig + 'static>(
|
||||
Path(pk): Path<String>,
|
||||
request: axum::http::Request<Body>,
|
||||
) -> Response {
|
||||
// Utiliser le param par défaut
|
||||
let param = C::default_param();
|
||||
serve_file_with_streaming(&cache, &pk, param, content_type, param_generator, request).await
|
||||
tracing::debug!(
|
||||
"[{}] GET /{}/{} param={}",
|
||||
C::cache_name(), C::cache_type(), pk, param
|
||||
);
|
||||
let response = serve_file_with_streaming(&cache, &pk, param, content_type, param_generator, request).await;
|
||||
tracing::debug!(
|
||||
"[{}] GET /{}/{} → {}",
|
||||
C::cache_name(), C::cache_type(), pk, response.status()
|
||||
);
|
||||
response
|
||||
}
|
||||
|
||||
/// Handler générique pour GET /{cache_name}/{cache_type}/{pk}/{param}
|
||||
@@ -267,6 +275,16 @@ async fn serve_file_with_streaming<C: CacheConfig + 'static>(
|
||||
}
|
||||
|
||||
// Fichier terminé ou pas de download en cours, servir normalement avec support Range
|
||||
if !file_path.exists() {
|
||||
// Fichier absent : soit download background pas encore terminé,
|
||||
// soit transformation WebP/variant pas encore écrite sur disque
|
||||
let in_db = cache.db.get(pk, false).is_ok();
|
||||
warn!(
|
||||
"Requested file not on disk yet: pk={} in_db={} path={:?} — client should retry",
|
||||
pk, in_db, file_path
|
||||
);
|
||||
}
|
||||
|
||||
let response = serve_complete_file(file_path, content_type, request).await;
|
||||
|
||||
if response.status().is_success() {
|
||||
@@ -287,7 +305,7 @@ async fn stream_file_progressive(
|
||||
request: axum::http::Request<Body>,
|
||||
) -> Response {
|
||||
use axum::http::header;
|
||||
use tokio::io::{AsyncReadExt, AsyncSeekExt};
|
||||
use tokio::io::AsyncSeekExt;
|
||||
|
||||
// Attendre qu'au moins 64 KB soient disponibles avant de commencer
|
||||
const MIN_SIZE_TO_START: u64 = 64 * 1024;
|
||||
@@ -602,6 +620,7 @@ pub fn create_api_router<C: CacheConfig + 'static>(cache: Arc<Cache<C>>) -> Rout
|
||||
///
|
||||
/// Permet d'initialiser un cache générique avec routes HTTP complètes
|
||||
#[cfg(feature = "pmoserver")]
|
||||
#[allow(async_fn_in_trait)]
|
||||
pub trait GenericCacheExt {
|
||||
/// Initialise un cache générique avec routes complètes
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user