mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-20 15:55:25 +03:00
Use proper scheduler that honors the parallel task limit (#14281)
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
|
||||
namespace MediaBrowser.Controller.LibraryTaskScheduler;
|
||||
|
||||
/// <summary>
|
||||
/// Provides a shared scheduler to run library related tasks based on the <see cref="ServerConfiguration.LibraryScanFanoutConcurrency"/>.
|
||||
/// </summary>
|
||||
public interface ILimitedConcurrencyLibraryScheduler
|
||||
{
|
||||
/// <summary>
|
||||
/// Enqueues an action that will be invoked with the set data.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The data Type.</typeparam>
|
||||
/// <param name="data">The data.</param>
|
||||
/// <param name="worker">The callback to process the data.</param>
|
||||
/// <param name="progress">A progress reporter.</param>
|
||||
/// <param name="cancellationToken">Stop token.</param>
|
||||
/// <returns>A task that finishes when all data has been processed by the worker.</returns>
|
||||
Task Enqueue<T>(T[] data, Func<T, IProgress<double>, Task> worker, IProgress<double> progress, CancellationToken cancellationToken);
|
||||
}
|
||||
Reference in New Issue
Block a user