mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-01 21:38:27 +01:00
Move MetadataRefreshThrottler to BaseItemManager
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using MediaBrowser.Controller.Channels;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
@@ -19,8 +20,22 @@ namespace MediaBrowser.Controller.BaseItemManager
|
||||
public BaseItemManager(IServerConfigurationManager serverConfigurationManager)
|
||||
{
|
||||
_serverConfigurationManager = serverConfigurationManager;
|
||||
|
||||
MetadataRefreshThrottler = new Lazy<SemaphoreSlim>(() => {
|
||||
var concurrency = _serverConfigurationManager.Configuration.LibraryMetadataRefreshConcurrency;
|
||||
|
||||
if (concurrency <= 0)
|
||||
{
|
||||
concurrency = Environment.ProcessorCount;
|
||||
}
|
||||
|
||||
return new SemaphoreSlim(concurrency);
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Lazy<SemaphoreSlim> MetadataRefreshThrottler { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool IsMetadataFetcherEnabled(BaseItem baseItem, LibraryOptions libraryOptions, string name)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
|
||||
namespace MediaBrowser.Controller.BaseItemManager
|
||||
@@ -8,6 +10,11 @@ namespace MediaBrowser.Controller.BaseItemManager
|
||||
/// </summary>
|
||||
public interface IBaseItemManager
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the semaphore used to limit the amount of concurrent metadata refreshes.
|
||||
/// </summary>
|
||||
Lazy<SemaphoreSlim> MetadataRefreshThrottler { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Is metadata fetcher enabled.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user