mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-10 15:25:42 -07:00
Miscellaneous HTTP/task improvements
This commit is contained in:
parent
cb19366db9
commit
3a826519fe
@ -41,7 +41,11 @@ namespace Bloxstrap
|
||||
public static readonly JsonManager<State> State = new();
|
||||
public static readonly FastFlagManager FastFlags = new();
|
||||
|
||||
public static readonly HttpClient HttpClient = new(new HttpClientLoggingHandler(new HttpClientHandler { AutomaticDecompression = DecompressionMethods.All }));
|
||||
public static readonly HttpClient HttpClient = new(
|
||||
new HttpClientLoggingHandler(
|
||||
new HttpClientHandler { AutomaticDecompression = DecompressionMethods.All }
|
||||
)
|
||||
);
|
||||
|
||||
public static void Terminate(ErrorCode exitCode = ErrorCode.ERROR_SUCCESS)
|
||||
{
|
||||
@ -107,7 +111,7 @@ namespace Bloxstrap
|
||||
|
||||
LaunchArgs = e.Args;
|
||||
|
||||
HttpClient.Timeout = TimeSpan.FromMinutes(5);
|
||||
HttpClient.Timeout = TimeSpan.FromSeconds(30);
|
||||
HttpClient.DefaultRequestHeaders.Add("User-Agent", ProjectRepository);
|
||||
|
||||
if (LaunchArgs.Length > 0)
|
||||
@ -295,9 +299,7 @@ namespace Bloxstrap
|
||||
}
|
||||
}
|
||||
|
||||
Task bootstrapperTask = Task.Run(() => bootstrapper.Run());
|
||||
|
||||
bootstrapperTask.ContinueWith(t =>
|
||||
Task bootstrapperTask = Task.Run(() => bootstrapper.Run()).ContinueWith(t =>
|
||||
{
|
||||
Logger.WriteLine(LOG_IDENT, "Bootstrapper task has finished");
|
||||
|
||||
|
@ -9,13 +9,13 @@
|
||||
|
||||
protected override HttpRequestMessage ProcessRequest(HttpRequestMessage request, CancellationToken cancellationToken)
|
||||
{
|
||||
App.Logger.WriteLine("HttpClientLoggingHandler::HttpRequestMessage", $"{request.Method} {request.RequestUri}");
|
||||
App.Logger.WriteLine("HttpClientLoggingHandler::ProcessRequest", $"{request.Method} {request.RequestUri}");
|
||||
return request;
|
||||
}
|
||||
|
||||
protected override HttpResponseMessage ProcessResponse(HttpResponseMessage response, CancellationToken cancellationToken)
|
||||
{
|
||||
App.Logger.WriteLine("HttpClientLoggingHandler::HttpResponseMessage", $"{(int)response.StatusCode} {response.ReasonPhrase} {response.RequestMessage!.RequestUri}");
|
||||
App.Logger.WriteLine("HttpClientLoggingHandler::ProcessResponse", $"{(int)response.StatusCode} {response.ReasonPhrase} {response.RequestMessage!.RequestUri}");
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user