From 1b49b171f443cc5639c8e3c26e76ce2514cb08ca Mon Sep 17 00:00:00 2001 From: Glax Date: Thu, 8 May 2025 03:22:31 +0200 Subject: [PATCH] Remove Manganato (for now) --- API/MangaDownloadClients/DownloadClient.cs | 9 ++++----- API/Program.cs | 2 +- API/Tranga.cs | 4 +--- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/API/MangaDownloadClients/DownloadClient.cs b/API/MangaDownloadClients/DownloadClient.cs index 60d5760..7c136bb 100644 --- a/API/MangaDownloadClients/DownloadClient.cs +++ b/API/MangaDownloadClients/DownloadClient.cs @@ -25,17 +25,16 @@ internal abstract class DownloadClient int rateLimit = TrangaSettings.userAgent == TrangaSettings.DefaultUserAgent ? TrangaSettings.DefaultRequestLimits[requestType] : TrangaSettings.requestLimits[requestType]; - Log.Debug($"Request limit {rateLimit}"); TimeSpan timeBetweenRequests = TimeSpan.FromMinutes(1).Divide(rateLimit); - _lastExecutedRateLimit.TryAdd(requestType, DateTime.UtcNow.Subtract(timeBetweenRequests)); - - TimeSpan rateLimitTimeout = timeBetweenRequests.Subtract(DateTime.UtcNow.Subtract(_lastExecutedRateLimit[requestType])); + DateTime now = DateTime.Now; + _lastExecutedRateLimit.TryAdd(requestType, now.Subtract(timeBetweenRequests)); + TimeSpan rateLimitTimeout = timeBetweenRequests.Subtract(now.Subtract(_lastExecutedRateLimit[requestType])); + Log.Debug($"Request limit {rateLimit}/Minute timeBetweenRequests: {timeBetweenRequests} Timeout: {rateLimitTimeout}"); if (rateLimitTimeout > TimeSpan.Zero) { - Log.Debug($"Timeout: {rateLimitTimeout}"); Thread.Sleep(rateLimitTimeout); } diff --git a/API/Program.cs b/API/Program.cs index 56d48b2..3e3af0b 100644 --- a/API/Program.cs +++ b/API/Program.cs @@ -117,7 +117,7 @@ using (var scope = app.Services.CreateScope()) new Mangaworld(), new ManhuaPlus(), new Weebcentral(), - new Manganato(), + //new Manganato(), new Global(scope.ServiceProvider.GetService()!) ]; MangaConnector[] newConnectors = connectors.Where(c => !context.MangaConnectors.Contains(c)).ToArray(); diff --git a/API/Tranga.cs b/API/Tranga.cs index e5e46b7..f1b7e56 100644 --- a/API/Tranga.cs +++ b/API/Tranga.cs @@ -135,10 +135,8 @@ public static class Tranga List runJobs = context.Jobs.Where(j => j.state <= JobState.Running && j.Enabled == true).ToList() .Where(j => j.NextExecution < DateTime.UtcNow).ToList(); - Log.Debug($"Due jobs: {runJobs.Count}"); - Log.Debug($"Running jobs: {RunningJobs.Count}"); IEnumerable orderedJobs = OrderJobs(runJobs, context).ToList(); - Log.Debug($"Ordered jobs: {orderedJobs.Count()}"); + Log.Debug($"Jobs Due: {runJobs.Count} Running: {RunningJobs.Count} Ordered: {orderedJobs.Count()}"); foreach (Job job in orderedJobs) { // If the job is already running, skip it