aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/IO/FileRefresher.cs
diff options
context:
space:
mode:
authorShadowghost <Ghost_of_Stone@web.de>2026-10-24 09:56:04 +0200
committerShadowghost <Ghost_of_Stone@web.de>2026-10-24 09:56:04 +0200
commitd95c2e1425d0d902e8191260ba9151f686aa2650 (patch)
tree3bc937664dcf9fe8d7659b00d92fc3a6c61be805 /Emby.Server.Implementations/IO/FileRefresher.cs
parentd3a92c69f8c1c5d1cda803a35f03175d6ba3b091 (diff)
parentc7ce6a1b56ee7dcc1896250df0f2f9deaa828a81 (diff)
Merge branch 'master' into port-async-migration-routines
# Conflicts: # Jellyfin.Server/Migrations/Routines/20260915120000_MigrateRatingLevels.cs
Diffstat (limited to 'Emby.Server.Implementations/IO/FileRefresher.cs')
-rw-r--r--Emby.Server.Implementations/IO/FileRefresher.cs27
1 files changed, 23 insertions, 4 deletions
diff --git a/Emby.Server.Implementations/IO/FileRefresher.cs b/Emby.Server.Implementations/IO/FileRefresher.cs
index f634084034..b31cf0f1f5 100644
--- a/Emby.Server.Implementations/IO/FileRefresher.cs
+++ b/Emby.Server.Implementations/IO/FileRefresher.cs
@@ -109,6 +109,11 @@ namespace Emby.Server.Implementations.IO
lock (_timerLock)
{
+ if (_disposed)
+ {
+ return;
+ }
+
paths = _affectedPaths.ToList();
}
@@ -129,11 +134,12 @@ namespace Emby.Server.Implementations.IO
private void ProcessPathChanges(List<string> paths)
{
- IEnumerable<BaseItem> itemsToRefresh = paths
+ var itemsToRefresh = paths
.Distinct()
- .Select(GetAffectedBaseItem)
- .Where(item => item is not null)
- .DistinctBy(x => x!.Id)!; // Removed null values in the previous .Where()
+ .Select(TryGetAffectedBaseItem)
+ .OfType<BaseItem>()
+ .DistinctBy(x => x.Id)
+ .ToList();
foreach (var item in itemsToRefresh)
{
@@ -155,6 +161,19 @@ namespace Emby.Server.Implementations.IO
}
}
+ private BaseItem? TryGetAffectedBaseItem(string path)
+ {
+ try
+ {
+ return GetAffectedBaseItem(path);
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Error finding the item affected by changes to {Path}", path);
+ return null;
+ }
+ }
+
/// <summary>
/// Gets the affected base item.
/// </summary>