add blocking detection nuget

This commit is contained in:
Stanley Dimant
2022-08-20 02:44:35 +02:00
parent 78543d0fc2
commit 1a22846eea
4 changed files with 6 additions and 26 deletions

View File

@@ -9,6 +9,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="AspNetCoreRateLimit" Version="4.0.2" /> <PackageReference Include="AspNetCoreRateLimit" Version="4.0.2" />
<PackageReference Include="Bazinga.AspNetCore.Authentication.Basic" Version="2.0.1" /> <PackageReference Include="Bazinga.AspNetCore.Authentication.Basic" Version="2.0.1" />
<PackageReference Include="Ben.BlockingDetector" Version="0.0.4" />
<PackageReference Include="Discord.Net" Version="3.7.2" /> <PackageReference Include="Discord.Net" Version="3.7.2" />
<PackageReference Include="EFCore.NamingConventions" Version="6.0.0" /> <PackageReference Include="EFCore.NamingConventions" Version="6.0.0" />
<PackageReference Include="Karambolo.Extensions.Logging.File" Version="3.3.1" /> <PackageReference Include="Karambolo.Extensions.Logging.File" Version="3.3.1" />

View File

@@ -1,13 +1,3 @@
{ {
"dependencies": { "dependencies": {}
"mssql1": {
"type": "mssql",
"connectionId": "ConnectionStrings:DefaultConnection",
"dynamicId": null
},
"secrets1": {
"type": "secrets",
"connectionId": null
}
}
} }

View File

@@ -1,16 +1,3 @@
{ {
"dependencies": { "dependencies": {}
"mssql1": {
"secretStore": "LocalSecretsFile",
"type": "mssql.onprem",
"connectionId": "ConnectionStrings:DefaultConnection",
"dynamicId": null
},
"secrets1": {
"secretStore": null,
"resourceId": null,
"type": "secrets.user",
"connectionId": null
}
}
} }

View File

@@ -17,6 +17,7 @@ using Microsoft.AspNetCore.Authorization;
using MareSynchronosServer.Discord; using MareSynchronosServer.Discord;
using AspNetCoreRateLimit; using AspNetCoreRateLimit;
using MareSynchronosServer.Throttling; using MareSynchronosServer.Throttling;
using Ben.Diagnostics;
namespace MareSynchronosServer namespace MareSynchronosServer
{ {
@@ -48,11 +49,11 @@ namespace MareSynchronosServer
services.AddDbContextPool<MareDbContext>(options => services.AddDbContextPool<MareDbContext>(options =>
{ {
options.EnableThreadSafetyChecks(false);
options.UseNpgsql(Configuration.GetConnectionString("DefaultConnection"), builder => options.UseNpgsql(Configuration.GetConnectionString("DefaultConnection"), builder =>
{ {
builder.MigrationsHistoryTable("_efmigrationshistory", "public"); builder.MigrationsHistoryTable("_efmigrationshistory", "public");
}).UseSnakeCaseNamingConvention(); }).UseSnakeCaseNamingConvention();
options.EnableThreadSafetyChecks(false);
}, Configuration.GetValue("DbContextPoolSize", 1024)); }, Configuration.GetValue("DbContextPoolSize", 1024));
services.AddHostedService<CleanupService>(); services.AddHostedService<CleanupService>();
@@ -81,6 +82,7 @@ namespace MareSynchronosServer
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{ {
app.UseBlockingDetection();
if (env.IsDevelopment()) if (env.IsDevelopment())
{ {