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:
@@ -125,6 +125,12 @@ public static class Tranga
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Action afterWorkCallback = AfterWork(worker, callback);
|
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)
|
if (worker is BaseWorkerWithContext<MangaContext> mangaContextWorker)
|
||||||
{
|
{
|
||||||
|
@@ -52,6 +52,8 @@ public struct TrangaSettings()
|
|||||||
|
|
||||||
public int MaxConcurrentDownloads { get; set; } = 5;
|
public int MaxConcurrentDownloads { get; set; } = 5;
|
||||||
|
|
||||||
|
public int MaxConcurrentWorkers { get; set; } = 10;
|
||||||
|
|
||||||
public static TrangaSettings Load()
|
public static TrangaSettings Load()
|
||||||
{
|
{
|
||||||
if (!File.Exists(settingsFilePath))
|
if (!File.Exists(settingsFilePath))
|
||||||
|
Reference in New Issue
Block a user