mirror of
https://github.com/Lidarr/Lidarr
synced 2025-12-06 08:25:54 +01:00
perf: Fix trace logging of HttpClient responses from blocking the UI and pegging the CPU
This commit is contained in:
parent
96e5a4df2f
commit
180c6fbe8b
1 changed files with 7 additions and 1 deletions
|
|
@ -169,7 +169,13 @@ private async Task<HttpResponse> ExecuteRequestAsync(HttpRequest request, Cookie
|
||||||
|
|
||||||
if (request.LogResponseContent && response.ResponseData != null)
|
if (request.LogResponseContent && response.ResponseData != null)
|
||||||
{
|
{
|
||||||
_logger.Trace("Response content ({0} bytes): {1}", response.ResponseData.Length, response.Content);
|
// Logging large response.Content is time consuming, pegs the CPU, and blocks the UI.
|
||||||
|
// Only evaluate the Trace call when tracing is actually enabled.
|
||||||
|
// Datapoint: NZBGet history endpoint with 500 items is about 1MB and takes 2m30s to log.
|
||||||
|
if (_logger.IsTraceEnabled)
|
||||||
|
{
|
||||||
|
_logger.Trace("Response content ({0} bytes): {1}", response.ResponseData.Length, response.Content);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue