This commit is contained in:
@@ -51,6 +51,7 @@ namespace AyaNova.Api.Controllers
|
||||
|
||||
#if (DEBUG)
|
||||
[HttpGet("collect")]
|
||||
[AllowAnonymous]
|
||||
public ActionResult GetCollect()
|
||||
{
|
||||
GC.Collect();
|
||||
@@ -59,6 +60,25 @@ namespace AyaNova.Api.Controllers
|
||||
|
||||
return Ok();
|
||||
}
|
||||
|
||||
|
||||
[HttpGet("hammer")]
|
||||
[AllowAnonymous]
|
||||
public async Task<IActionResult> GetHammer()
|
||||
{
|
||||
//test allocation and cleanup
|
||||
for (int x = 0; x < 100000; x++)
|
||||
{
|
||||
AyContext ct = AyaNova.Util.ServiceProviderProvider.DBContext;
|
||||
var v=await ct.Widget.Where(z=>z.Serial<100).ToListAsync();
|
||||
// int i = await ct.Database.ExecuteSqlRawAsync($"select * from aglobalbizsettings");
|
||||
}
|
||||
|
||||
return Ok();
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -49,21 +49,22 @@ namespace AyaNova
|
||||
{
|
||||
_newLog.LogDebug("Initializing services...");
|
||||
|
||||
_newLog.LogDebug("Profiler");
|
||||
//https://dotnetthoughts.net/using-miniprofiler-in-aspnetcore-webapi/
|
||||
services.AddMemoryCache();
|
||||
services.AddMiniProfiler(options =>
|
||||
{
|
||||
options.RouteBasePath = "/profiler";
|
||||
//in testing only ignorepaths was reliable and worked and docs say it prevents any profiling at all
|
||||
options.IgnorePath("/auth").IgnorePath("/user").IgnorePath("/docs");
|
||||
options.ResultsAuthorize = request =>
|
||||
{
|
||||
if (request.HttpContext.Items["AY_PROFILER_ALLOWED"] != null)
|
||||
return true;
|
||||
return false;
|
||||
};
|
||||
}).AddEntityFramework();
|
||||
// _newLog.LogDebug("Profiler");
|
||||
// //https://dotnetthoughts.net/using-miniprofiler-in-aspnetcore-webapi/
|
||||
// services.AddMemoryCache();
|
||||
// services.AddMiniProfiler(options =>
|
||||
// {
|
||||
// options.RouteBasePath = "/profiler";
|
||||
// //in testing only ignorepaths was reliable and worked and docs say it prevents any profiling at all
|
||||
// options.IgnorePath("/auth").IgnorePath("/user").IgnorePath("/docs");
|
||||
// options.ResultsAuthorize = request =>
|
||||
// {
|
||||
// if (request.HttpContext.Items["AY_PROFILER_ALLOWED"] != null)
|
||||
// return true;
|
||||
// return false;
|
||||
// };
|
||||
// //options.ShouldProfile = request => false;
|
||||
// }).AddEntityFramework();
|
||||
|
||||
|
||||
//Server state service for shutting people out of api
|
||||
@@ -473,7 +474,7 @@ namespace AyaNova
|
||||
|
||||
|
||||
_newLog.LogDebug("Profiler");
|
||||
app.UseMiniProfiler();
|
||||
// app.UseMiniProfiler();
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -28,6 +28,10 @@ namespace AyaNova.Util
|
||||
{
|
||||
get
|
||||
{
|
||||
// System.Diagnostics.Debug.WriteLine((new System.Diagnostics.StackTrace()).GetFrame(1).GetMethod().Name);
|
||||
|
||||
// System.Diagnostics.Debug.WriteLine((new System.Diagnostics.StackTrace()).ToString().Substring(56,80));
|
||||
|
||||
return Scope.ServiceProvider.GetRequiredService<AyContext>();
|
||||
}
|
||||
}
|
||||
@@ -39,7 +43,7 @@ namespace AyaNova.Util
|
||||
return Scope.ServiceProvider.GetRequiredService<AyaNova.Api.ControllerHelpers.ApiServerState>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// https://docs.microsoft.com/en-us/aspnet/core/fundamentals/http-requests?view=aspnetcore-3.1
|
||||
internal static System.Net.Http.IHttpClientFactory HttpClientFactory
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user