mirror of
https://github.com/C9Glax/tranga.git
synced 2025-09-10 03:48:19 +02:00
Max Worker Concurrency
This commit is contained in:
@@ -126,6 +126,12 @@ public static class Tranga
|
||||
}
|
||||
Action afterWorkCallback = AfterWork(worker, callback);
|
||||
|
||||
while (RunningWorkers.Count > Settings.MaxConcurrentWorkers)
|
||||
{
|
||||
Log.Warn($"{worker}: Max worker concurrency reached ({Settings.MaxConcurrentWorkers})! Waiting {Settings.WorkCycleTimeoutMs}ms...");
|
||||
Thread.Sleep(Settings.WorkCycleTimeoutMs);
|
||||
}
|
||||
|
||||
if (worker is BaseWorkerWithContext<MangaContext> mangaContextWorker)
|
||||
{
|
||||
mangaContextWorker.SetScope(ServiceProvider.CreateScope());
|
||||
|
@@ -52,6 +52,8 @@ public struct TrangaSettings()
|
||||
|
||||
public int MaxConcurrentDownloads { get; set; } = 5;
|
||||
|
||||
public int MaxConcurrentWorkers { get; set; } = 10;
|
||||
|
||||
public static TrangaSettings Load()
|
||||
{
|
||||
if (!File.Exists(settingsFilePath))
|
||||
|
Reference in New Issue
Block a user