Fix #468 failed downloads (Task cancelled) results in empty chapter archive
Some checks are pending
Docker Image CI / build (push) Waiting to run

This commit is contained in:
2025-10-10 18:23:27 +02:00
parent f72fdf54f1
commit 3ff44339b5
5 changed files with 20 additions and 23 deletions

View File

@@ -14,7 +14,7 @@ internal class HttpDownloadClient : IDownloadClient
private static readonly FlareSolverrDownloadClient FlareSolverrDownloadClient = new(Client);
private ILog Log { get; } = LogManager.GetLogger(typeof(HttpDownloadClient));
public async Task<HttpResponseMessage> MakeRequest(string url, RequestType requestType, string? referrer = null)
public async Task<HttpResponseMessage> MakeRequest(string url, RequestType requestType, string? referrer = null, CancellationToken? cancellationToken = null)
{
Log.Debug($"Using {typeof(HttpDownloadClient).FullName} for {url}");
HttpRequestMessage requestMessage = new(HttpMethod.Get, url);
@@ -24,7 +24,7 @@ internal class HttpDownloadClient : IDownloadClient
try
{
HttpResponseMessage response = await Client.SendAsync(requestMessage);
HttpResponseMessage response = await Client.SendAsync(requestMessage, cancellationToken ?? CancellationToken.None);
Log.Debug($"Request {url} returned {(int)response.StatusCode} {response.StatusCode}");
if(response.IsSuccessStatusCode)
return response;