mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
Merge pull request #8826 from Bond-009/slowhttp
Fixes https://github.com/jellyfin/jellyfin/issues/7348
This commit is contained in:
commit
47f1d1395c
@ -47,9 +47,10 @@ namespace Jellyfin.Server.Middleware
|
|||||||
context.Response.OnStarting(() =>
|
context.Response.OnStarting(() =>
|
||||||
{
|
{
|
||||||
watch.Stop();
|
watch.Stop();
|
||||||
if (enableWarning && watch.ElapsedMilliseconds > warningThreshold)
|
var responseTimeForCompleteRequest = watch.ElapsedMilliseconds;
|
||||||
|
if (enableWarning && responseTimeForCompleteRequest > warningThreshold && _logger.IsEnabled(LogLevel.Debug))
|
||||||
{
|
{
|
||||||
_logger.LogWarning(
|
_logger.LogDebug(
|
||||||
"Slow HTTP Response from {Url} to {RemoteIp} in {Elapsed:g} with Status Code {StatusCode}",
|
"Slow HTTP Response from {Url} to {RemoteIp} in {Elapsed:g} with Status Code {StatusCode}",
|
||||||
context.Request.GetDisplayUrl(),
|
context.Request.GetDisplayUrl(),
|
||||||
context.GetNormalizedRemoteIp(),
|
context.GetNormalizedRemoteIp(),
|
||||||
@ -57,7 +58,6 @@ namespace Jellyfin.Server.Middleware
|
|||||||
context.Response.StatusCode);
|
context.Response.StatusCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
var responseTimeForCompleteRequest = watch.ElapsedMilliseconds;
|
|
||||||
context.Response.Headers[ResponseHeaderResponseTime] = responseTimeForCompleteRequest.ToString(CultureInfo.InvariantCulture);
|
context.Response.Headers[ResponseHeaderResponseTime] = responseTimeForCompleteRequest.ToString(CultureInfo.InvariantCulture);
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user