Max Worker Concurrency

This commit is contained in:
2025-09-05 01:13:31 +02:00
parent 35e36a557c
commit 65418c0495
2 changed files with 8 additions and 0 deletions

View File

@@ -125,6 +125,12 @@ public static class Tranga
return;
}
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)
{

View File

@@ -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))