Skip to content

Commit

Permalink
Merge pull request #233 from tpill90/TimeoutRefactor
Browse files Browse the repository at this point in the history
  • Loading branch information
tpill90 authored Dec 9, 2022
2 parents 33b05ee + 0c140fa commit 70e226f
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions LancachePrefill.Common/Colors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ public static class SpectreFormatters
public static string LightRed(object inputObj) => $"[{SpectreColors.LightRed.ToMarkup()}]{inputObj}[/]";
public static string LightYellow(object inputObj) => $"[rgb(249,241,165)]{inputObj}[/]";

public static string ForestGreen(object inputObj) => $"[rgb(121,158,105)]{inputObj}[/]";

public static string Green(object inputObj) => $"[green]{inputObj}[/]";
public static string Grey(object inputObj) => $"[grey]{inputObj}[/]";

Expand Down
2 changes: 1 addition & 1 deletion LancachePrefill.Common/LancacheIpResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ await _ansiConsole.StatusSpinner().StartAsync("Detecting Lancache server...", as

private static async Task<DetectedServer> DetectLancacheServerAsync(string cdnUrl)
{
using var httpClient = new HttpClient { Timeout = TimeSpan.FromSeconds(3) };
using var httpClient = new HttpClient { Timeout = TimeSpan.FromSeconds(15) };

// Tries to resolve poisoned DNS record, then localhost, then Docker's host
var possibleLancacheUrls = new List<string> { cdnUrl, "localhost", "172.17.0.1" };
Expand Down
2 changes: 1 addition & 1 deletion LancachePrefill.Common/UpdateChecker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static async Task CheckForUpdatesAsync(Type executingAppType, string repo
}

using var httpClient = new HttpClient();
httpClient.Timeout = TimeSpan.FromSeconds(5);
httpClient.Timeout = TimeSpan.FromSeconds(15);
httpClient.DefaultRequestHeaders.Accept.Clear();
httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/vnd.github.v3+json"));
httpClient.DefaultRequestHeaders.Add("User-Agent", repoName);
Expand Down
2 changes: 1 addition & 1 deletion SteamPrefill/Handlers/DownloadHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public DownloadHandler(IAnsiConsole ansiConsole, CdnPool cdnPool)

_client = new HttpClient
{
Timeout = TimeSpan.FromSeconds(15)
Timeout = AppConfig.SteamKitRequestTimeout
};
_client.DefaultRequestHeaders.Add("User-Agent", "Valve/Steam HTTP Client 1.0");
}
Expand Down
2 changes: 1 addition & 1 deletion SteamPrefill/Handlers/Steam/CdnPool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ await Task.Run(async () =>
&& (e.Type == "SteamCache" || e.Type == "CDN"))
.DistinctBy(e => e.Host)
.ToConcurrentStack();
}).WaitAsync(TimeSpan.FromSeconds(6));
}).WaitAsync(TimeSpan.FromSeconds(15));
}
catch (TimeoutException)
{
Expand Down
2 changes: 1 addition & 1 deletion SteamPrefill/Handlers/Steam/SteamChartsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public static async Task<List<MostPlayedGame>> MostPlayedByDailyPlayersAsync(IAn
{
using var httpClient = new HttpClient
{
Timeout = TimeSpan.FromSeconds(5)
Timeout = TimeSpan.FromSeconds(15)
};

using var request = new HttpRequestMessage(HttpMethod.Get, new Uri("https://api.steampowered.com/ISteamChartsService/GetMostPlayedGames/v1/"));
Expand Down

0 comments on commit 70e226f

Please sign in to comment.