This commit is contained in:
2020-01-28 00:28:52 +00:00
parent 7c14567e3c
commit 4f0a2d08da
5 changed files with 7 additions and 12 deletions

View File

@@ -4,13 +4,9 @@ eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOiIxNTcxODU5OTU0IiwiZXhwIjoiMTU3MjQ
## IMMEDIATE ITEMS
TODO: Ensure scaleability by checking for performance issues now before replicating code (particularly in widget etc)
- As per this document https://docs.microsoft.com/en-us/aspnet/core/performance/performance-best-practices?view=aspnetcore-3.1
- For scaleability go back to async only for any db calls functions like creating widgets etc
TODO: look for any line of code that does this or similar: await Task.CompletedTask, [anything].Result;
- Needs to be turned into a true async function or not an async function
TODO: Look at any of my middleware code as it's a HOT PATH, make sure it's async db access etc and nothing slowing it down

View File

@@ -93,7 +93,7 @@ namespace AyaNova.Api.ControllerHelpers
//This line is critical, without it the response is not proper and fails in various clients (postman, xunit tests with httpclient)
context.ExceptionHandled = true;
//context.Result
response.WriteAsync(JsonConvert.SerializeObject(
new ApiErrorResponse(ApiErrorCode.API_SERVER_ERROR, "Server internal error", "See server log for details"),

View File

@@ -63,7 +63,7 @@ namespace AyaNova.Api.Controllers
<a href=""/docs"" target=""_blank"">AyaNova manual</a><br/><br/>
<a href=""/api-docs"" target=""_blank"">API explorer</a><br/><br/>
<a href=""mailto:support@ayanova.com"">Email AyaNova support</a><br/><br/>
<h4>{LocaleBiz.GetDefaultLocalizedTextAsync("HelpLicense").Result}</h4>
<h4>{await LocaleBiz.GetDefaultLocalizedTextAsync("HelpLicense")}</h4>
<pre>{AyaNova.Core.License.LicenseInfo}</pre>
<h4>Schema version</h4>
<pre>{AySchema.currentSchema.ToString()}</pre>

View File

@@ -364,7 +364,8 @@ namespace AyaNova
var ct = context.RequestServices.GetService<AyContext>();
//get the user record
var u = ct.User.AsNoTracking().Where(a => a.Id == userId).Select(m => new { roles = m.Roles, name = m.Name, id = m.Id, localeId = m.LocaleId }).First();
//var u = ct.User.AsNoTracking().Where(a => a.Id == userId).Select(m => new { roles = m.Roles, name = m.Name, id = m.Id, localeId = m.LocaleId }).First();
var u = await ct.User.AsNoTracking().Where(a => a.Id == userId).Select(m => new { roles = m.Roles, name = m.Name, id = m.Id, localeId = m.LocaleId }).FirstAsync();
context.Request.HttpContext.Items["AY_ROLES"] = u.roles;
context.Request.HttpContext.Items["AY_USERNAME"] = u.name;
context.Request.HttpContext.Items["AY_USER_ID"] = u.id;

View File

@@ -605,9 +605,7 @@ namespace AyaNova.Util
o.CustomFields = $@"{{c1:""{c1}"",c2:""{c2}"",c3:{c3},c4:{c4},c5:{c5}}}";
//var NewObject = Cached_WidgetBiz.CreateAsync(o).Result;
//test without cached widgetbiz
WidgetBiz biz = WidgetBiz.GetBizInternal(ServiceProviderProvider.DBContext);
var NewObject = await biz.CreateAsync(o);
if (NewObject == null)