Update library lists when a move finishes (#1)
CI / test (push) Successful in 1m14s

The Library now follows moves on both servers: an item shows "Moving to …" while it moves and "Moved to …" until the source's Jellyfin drops
it after its rescan; the list reloads when a move finishes and checks again every 20 s for a few minutes. The destination shows the new item
straight away.
This commit is contained in:
IxianPixel committed 2026-11-06 17:21:22 +00:00
1 parent 484ac50508
commit 2bd4489b1a
9 files changed
+236 -61

No files matched your search

+9 -1
View File
@@ -20,7 +20,7 @@ use std::sync::Mutex;
use serde::{Deserialize, Serialize};
use time::OffsetDateTime;
use crate::state::Shared;
use crate::state::{AppState, Shared};
/// How often a cached size's signature is checked against the disk.
pub const RECHECK: time::Duration = time::Duration::hours(1);
@@ -151,6 +151,14 @@ async fn refresh(state: &Shared, folder: &Path) -> anyhow::Result<()> {
Ok(())
}
/// Drop the cached size of a folder a move has just changed, so the next
/// listing measures it again instead of waiting for the hourly check.
pub async fn forget(state: &AppState, folder: &Path) {
if let Err(e) = state.store.delete_folder_size(&key(folder)).await {
tracing::warn!(folder = %folder.display(), error = %e, "could not forget folder size");
}
}
fn key(p: &Path) -> String {
p.to_string_lossy().into_owned()
}