Skip to content

Commit

Permalink
Fix an issue where a request-timeout would cause a restartloop.
Browse files Browse the repository at this point in the history
  • Loading branch information
C9Glax committed Oct 19, 2023
1 parent ca9c0b2 commit f78bec4
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions Tranga/MangaConnectors/HttpDownloadClient.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Net.Http.Headers;
using System.Net;
using System.Net.Http.Headers;
using HtmlAgilityPack;

namespace Tranga.MangaConnectors;
Expand Down Expand Up @@ -32,7 +33,15 @@ protected override RequestResult MakeRequestInternal(string url, string? referre
if (referrer is not null)
requestMessage.Headers.Referrer = new Uri(referrer);
//Log($"Requesting {requestType} {url}");
response = Client.Send(requestMessage);
try
{
response = Client.Send(requestMessage);
}
catch (TaskCanceledException e)
{
Log($"Request timed out.\n\r{e}");
return new RequestResult(HttpStatusCode.RequestTimeout, null, Stream.Null);
}
}

if (!response.IsSuccessStatusCode)
Expand Down

0 comments on commit f78bec4

Please sign in to comment.