aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Providers
diff options
context:
space:
mode:
authorNiels van Velzen <nielsvanvelzen@users.noreply.github.com>2026-05-03 21:56:34 +0200
committerGitHub <noreply@github.com>2026-05-03 21:56:34 +0200
commit6e22075a63432aae48859cf9c67fde158dc80d2e (patch)
treec3a33238cc56857d8e3daa56db01f290118c9215 /MediaBrowser.Controller/Providers
parentd9ced0d6399c82ddad9e983605bb0d828a608e63 (diff)
parentd68d0fa96267ad96eaa5a0ba37e072f59a71442a (diff)
Merge pull request #16062 from Shadowghost/perf-rebased
Query Performance Improvements
Diffstat (limited to 'MediaBrowser.Controller/Providers')
-rw-r--r--MediaBrowser.Controller/Providers/DirectoryService.cs31
1 files changed, 29 insertions, 2 deletions
diff --git a/MediaBrowser.Controller/Providers/DirectoryService.cs b/MediaBrowser.Controller/Providers/DirectoryService.cs
index a1edfa3c96..5b5af75a47 100644
--- a/MediaBrowser.Controller/Providers/DirectoryService.cs
+++ b/MediaBrowser.Controller/Providers/DirectoryService.cs
@@ -3,6 +3,7 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
+using System.IO;
using System.Linq;
using MediaBrowser.Model.IO;
@@ -26,7 +27,20 @@ namespace MediaBrowser.Controller.Providers
public FileSystemMetadata[] GetFileSystemEntries(string path)
{
- return _cache.GetOrAdd(path, static (p, fileSystem) => fileSystem.GetFileSystemEntries(p).ToArray(), _fileSystem);
+ return _cache.GetOrAdd(
+ path,
+ static (p, fileSystem) =>
+ {
+ try
+ {
+ return fileSystem.GetFileSystemEntries(p).ToArray();
+ }
+ catch (DirectoryNotFoundException)
+ {
+ return [];
+ }
+ },
+ _fileSystem);
}
public List<FileSystemMetadata> GetDirectories(string path)
@@ -98,7 +112,20 @@ namespace MediaBrowser.Controller.Providers
_filePathCache.TryRemove(path, out _);
}
- var filePaths = _filePathCache.GetOrAdd(path, static (p, fileSystem) => fileSystem.GetFilePaths(p).ToList(), _fileSystem);
+ var filePaths = _filePathCache.GetOrAdd(
+ path,
+ static (p, fileSystem) =>
+ {
+ try
+ {
+ return fileSystem.GetFilePaths(p).ToList();
+ }
+ catch (DirectoryNotFoundException)
+ {
+ return [];
+ }
+ },
+ _fileSystem);
if (sort)
{