The Free Software Media System - Server Backend & API
rework device concurrency
Luke Pulverenti82495f9ac31d
diff --git a/MediaBrowser.Server.Implementations/Devices/DeviceRepository.cs b/MediaBrowser.Server.Implementations/Devices/DeviceRepository.csindex 43b1e693cc..9e4a45253d 100644--- a/MediaBrowser.Server.Implementations/Devices/DeviceRepository.cs+++ b/MediaBrowser.Server.Implementations/Devices/DeviceRepository.cs@@ -25,7 +25,7 @@ namespace MediaBrowser.Server.Implementations.Devicesprivate readonly ILogger _logger;private readonly IFileSystem _fileSystem;- private ConcurrentBag<DeviceInfo> _devices;+ private List<DeviceInfo> _devices;public DeviceRepository(IApplicationPaths appPaths, IJsonSerializer json, ILogger logger, IFileSystem fileSystem){@@ -93,17 +93,14 @@ namespace MediaBrowser.Server.Implementations.Devicespublic IEnumerable<DeviceInfo> GetDevices(){- if (_devices == null)+ lock (_syncLock){- lock (_syncLock)+ if (_devices == null){- if (_devices == null)- {- _devices = new ConcurrentBag<DeviceInfo>(LoadDevices());- }+ _devices = LoadDevices().ToList();}+ return _devices.ToList();}- return _devices.ToList();}private IEnumerable<DeviceInfo> LoadDevices()