fix(thumbnail): add timeout protection for large image processing
Resolves conflict between main and PR #229 by applying timeout support on top of main's drop(data) memory optimization. Changes: - Add thumbnail_generation_ms to TimeoutConfig (default 30s) - Add generation_timeout field to ThumbnailService - Wrap spawn_blocking in tokio::time::timeout to prevent hanging - Update DI to pass timeout from config - Update tests to provide timeout parameter https://claude.ai/code/session_015FD62aAoMYx1XBZbzPvUu8
This commit is contained in:
+2
-1
@@ -119,12 +119,13 @@ impl AppServiceFactory {
|
||||
}));
|
||||
tracing::info!("FileContentCache initialized: max 10MB/file, 512MB total, 10k entries");
|
||||
|
||||
// Thumbnail service for thumbnail generation
|
||||
// Thumbnail service for thumbnail generation with timeout protection
|
||||
let thumbnail_service = Arc::new(
|
||||
crate::infrastructure::services::thumbnail_service::ThumbnailService::new(
|
||||
&self.storage_path,
|
||||
5000, // max 5000 thumbnails in cache
|
||||
100 * 1024 * 1024, // max 100MB cache
|
||||
Some(self.config.timeouts.thumbnail_timeout()),
|
||||
),
|
||||
);
|
||||
// Initialize thumbnail directories
|
||||
|
||||
Reference in New Issue
Block a user