From fdde64021b1ee29c699810840dbb0b4c2cf3183e Mon Sep 17 00:00:00 2001 From: glax Date: Thu, 25 Sep 2025 02:07:20 +0200 Subject: [PATCH] More logging --- API/MangaConnectors/MangaPark.cs | 4 ++++ API/MangaDownloadClients/DownloadClient.cs | 5 ++++- API/MangaDownloadClients/HttpDownloadClient.cs | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/API/MangaConnectors/MangaPark.cs b/API/MangaConnectors/MangaPark.cs index 6c356d2..e2c46d1 100644 --- a/API/MangaConnectors/MangaPark.cs +++ b/API/MangaConnectors/MangaPark.cs @@ -28,6 +28,7 @@ public class MangaPark : MangaConnector private (Manga, MangaConnectorId)[]? SearchMangaWithDomain(string mangaSearchName, string domain) { + Log.Debug($"Using domain {domain}"); Uri baseUri = new($"https://{domain}/"); List<(Manga, MangaConnectorId)> ret = []; @@ -68,6 +69,7 @@ public class MangaPark : MangaConnector private (Manga, MangaConnectorId)? GetMangaFromIdWithDomain(string mangaIdOnSite, string domain) { + Log.Debug($"Using domain {domain}"); Uri baseUri = new ($"https://{domain}/"); return GetMangaFromUrl(new Uri(baseUri, $"title/{mangaIdOnSite}").ToString()); } @@ -140,6 +142,7 @@ public class MangaPark : MangaConnector private (Chapter, MangaConnectorId)[]? GetChaptersFromDomain(MangaConnectorId mangaId, string domain) { + Log.Debug($"Using domain {domain}"); Uri baseUri = new ($"https://{domain}/"); Uri requestUri = new (baseUri, $"title/{mangaId.IdOnConnectorSite}"); @@ -217,6 +220,7 @@ public class MangaPark : MangaConnector private string[]? GetChapterImageUrlsFromDomain(MangaConnectorId chapterId, string domain) { + Log.Debug($"Using domain {domain}"); Uri baseUri = new ($"https://{domain}/"); Uri requestUri = new (baseUri, $"title/{chapterId.IdOnConnectorSite}"); if (downloadClient.MakeRequest(requestUri.ToString(), RequestType.Default) is diff --git a/API/MangaDownloadClients/DownloadClient.cs b/API/MangaDownloadClients/DownloadClient.cs index 2faa7a3..d4f5741 100644 --- a/API/MangaDownloadClients/DownloadClient.cs +++ b/API/MangaDownloadClients/DownloadClient.cs @@ -36,9 +36,12 @@ public abstract class DownloadClient TimeSpan rateLimitTimeout = timeBetweenRequests.Subtract(now.Subtract(LastExecutedRateLimit[requestType])); Log.Debug($"Request limit {requestType} {rateLimit}/Minute timeBetweenRequests: {timeBetweenRequests:ss'.'fffff} Timeout: {rateLimitTimeout:ss'.'fffff}"); - + if (rateLimitTimeout > TimeSpan.Zero) + { + Log.Info($"Waiting {rateLimitTimeout} for {url}"); Thread.Sleep(rateLimitTimeout); + } // Make the request RequestResult result = MakeRequestInternal(url, referrer, clickButton); diff --git a/API/MangaDownloadClients/HttpDownloadClient.cs b/API/MangaDownloadClients/HttpDownloadClient.cs index 9735883..d0babb0 100644 --- a/API/MangaDownloadClients/HttpDownloadClient.cs +++ b/API/MangaDownloadClients/HttpDownloadClient.cs @@ -8,6 +8,7 @@ internal class HttpDownloadClient : DownloadClient private static readonly FlareSolverrDownloadClient FlareSolverrDownloadClient = new(); internal override RequestResult MakeRequestInternal(string url, string? referrer = null, string? clickButton = null) { + Log.Debug($"Using {typeof(HttpDownloadClient).FullName} for {url}"); if (clickButton is not null) Log.Warn("Client can not click button"); HttpClient client = new();