fix: local_files hot-reload via RwLock state fields + rebuild_registry local_files case
This commit is contained in:
@@ -39,13 +39,16 @@ pub struct AppState {
|
||||
pub activity_log_repo: Arc<dyn ActivityLogRepository>,
|
||||
/// Index for the local-files provider, used by the rescan route.
|
||||
#[cfg(feature = "local-files")]
|
||||
pub local_index: Option<Arc<infra::LocalIndex>>,
|
||||
pub local_index: Arc<tokio::sync::RwLock<Option<Arc<infra::LocalIndex>>>>,
|
||||
/// TranscodeManager for FFmpeg HLS transcoding (requires TRANSCODE_DIR).
|
||||
#[cfg(feature = "local-files")]
|
||||
pub transcode_manager: Option<Arc<infra::TranscodeManager>>,
|
||||
pub transcode_manager: Arc<tokio::sync::RwLock<Option<Arc<infra::TranscodeManager>>>>,
|
||||
/// SQLite pool for transcode settings CRUD.
|
||||
#[cfg(feature = "local-files")]
|
||||
pub sqlite_pool: Option<sqlx::SqlitePool>,
|
||||
pub sqlite_pool: Arc<tokio::sync::RwLock<Option<sqlx::SqlitePool>>>,
|
||||
/// Raw sqlite pool — always present when running SQLite, used for local-files hot-reload.
|
||||
#[cfg(feature = "local-files")]
|
||||
pub raw_sqlite_pool: Option<sqlx::SqlitePool>,
|
||||
}
|
||||
|
||||
impl AppState {
|
||||
@@ -137,11 +140,13 @@ impl AppState {
|
||||
log_history,
|
||||
activity_log_repo,
|
||||
#[cfg(feature = "local-files")]
|
||||
local_index: None,
|
||||
local_index: Arc::new(tokio::sync::RwLock::new(None)),
|
||||
#[cfg(feature = "local-files")]
|
||||
transcode_manager: None,
|
||||
transcode_manager: Arc::new(tokio::sync::RwLock::new(None)),
|
||||
#[cfg(feature = "local-files")]
|
||||
sqlite_pool: None,
|
||||
sqlite_pool: Arc::new(tokio::sync::RwLock::new(None)),
|
||||
#[cfg(feature = "local-files")]
|
||||
raw_sqlite_pool: None,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user