mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-05-30 19:55:08 -04:00
Removing CollectionFolders from cache when they are deleted on disk. (#13315)
This commit is contained in:
parent
4fa2f2475c
commit
ce64dbc034
@ -1049,9 +1049,17 @@ namespace Emby.Server.Implementations.Library
|
|||||||
cancellationToken: cancellationToken).ConfigureAwait(false);
|
cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
// Quickly scan CollectionFolders for changes
|
// Quickly scan CollectionFolders for changes
|
||||||
foreach (var folder in GetUserRootFolder().Children.OfType<Folder>())
|
foreach (var child in GetUserRootFolder().Children.OfType<Folder>())
|
||||||
{
|
{
|
||||||
await folder.RefreshMetadata(cancellationToken).ConfigureAwait(false);
|
// If the user has somehow deleted the collection directory, remove the metadata from the database.
|
||||||
|
if (child is CollectionFolder collectionFolder && !Directory.Exists(collectionFolder.Path))
|
||||||
|
{
|
||||||
|
_itemRepository.DeleteItem(collectionFolder.Id);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await child.RefreshMetadata(cancellationToken).ConfigureAwait(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user