mirror of
				https://github.com/jellyfin/jellyfin.git
				synced 2025-10-31 02:27:18 -04:00 
			
		
		
		
	rework device concurrency
This commit is contained in:
		
							parent
							
								
									17cf1f3a6d
								
							
						
					
					
						commit
						82495f9ac3
					
				| @ -25,7 +25,7 @@ namespace MediaBrowser.Server.Implementations.Devices | |||||||
|         private readonly ILogger _logger; |         private readonly ILogger _logger; | ||||||
|         private readonly IFileSystem _fileSystem; |         private readonly IFileSystem _fileSystem; | ||||||
| 
 | 
 | ||||||
|         private ConcurrentBag<DeviceInfo> _devices; |         private List<DeviceInfo> _devices; | ||||||
| 
 | 
 | ||||||
|         public DeviceRepository(IApplicationPaths appPaths, IJsonSerializer json, ILogger logger, IFileSystem fileSystem) |         public DeviceRepository(IApplicationPaths appPaths, IJsonSerializer json, ILogger logger, IFileSystem fileSystem) | ||||||
|         { |         { | ||||||
| @ -93,17 +93,14 @@ namespace MediaBrowser.Server.Implementations.Devices | |||||||
| 
 | 
 | ||||||
|         public IEnumerable<DeviceInfo> GetDevices() |         public IEnumerable<DeviceInfo> GetDevices() | ||||||
|         { |         { | ||||||
|             if (_devices == null) |             lock (_syncLock) | ||||||
|             { |             { | ||||||
|                 lock (_syncLock) |                 if (_devices == null) | ||||||
|                 { |                 { | ||||||
|                     if (_devices == null) |                     _devices = LoadDevices().ToList(); | ||||||
|                     { |  | ||||||
|                         _devices = new ConcurrentBag<DeviceInfo>(LoadDevices()); |  | ||||||
|                     } |  | ||||||
|                 } |                 } | ||||||
|  |                 return _devices.ToList(); | ||||||
|             } |             } | ||||||
|             return _devices.ToList(); |  | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         private IEnumerable<DeviceInfo> LoadDevices() |         private IEnumerable<DeviceInfo> LoadDevices() | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user