mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-27 15:07:03 +01:00
Fix cancelled requests being logged as errors during startup
Also cleanup ApplicationBuilderExtensions.cs
This commit is contained in:
@@ -437,15 +437,12 @@ namespace Tgstation.Server.Host.Core
|
||||
// Add the X-Powered-By response header
|
||||
applicationBuilder.UseServerBranding(assemblyInformationProvider);
|
||||
|
||||
// 503 requests made while the application is starting
|
||||
applicationBuilder.UseAsyncInitialization(async (cancellationToken) =>
|
||||
{
|
||||
await instanceManager.Ready.WithToken(cancellationToken);
|
||||
});
|
||||
|
||||
// suppress OperationCancelledExceptions, they are just aborted HTTP requests
|
||||
applicationBuilder.UseCancelledRequestSuppression();
|
||||
|
||||
// 503 requests made while the application is starting
|
||||
applicationBuilder.UseAsyncInitialization(instanceManager.Ready.WithToken);
|
||||
|
||||
if (generalConfiguration.HostApiDocumentation)
|
||||
{
|
||||
applicationBuilder.UseSwagger();
|
||||
|
||||
@@ -103,6 +103,7 @@ namespace Tgstation.Server.Host.Extensions
|
||||
{
|
||||
if (applicationBuilder == null)
|
||||
throw new ArgumentNullException(nameof(applicationBuilder));
|
||||
|
||||
applicationBuilder.Use(async (context, next) =>
|
||||
{
|
||||
var logger = GetLogger(context);
|
||||
@@ -124,8 +125,7 @@ namespace Tgstation.Server.Host.Extensions
|
||||
.ExecuteResultAsync(new ActionContext
|
||||
{
|
||||
HttpContext = context,
|
||||
})
|
||||
;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user