This commit is contained in:
@@ -11,7 +11,7 @@ Baseline from before doing anything seeding a medium level with full text
|
||||
2020-01-21 16:49:39.4481|INFO|Seeder|500 Widgets seeded in 21968 ms
|
||||
|
||||
After round one of improvements (less text in seed data notes, not calling savechanges or add async)
|
||||
//about 2 seconds came from the async db stuff and the rest was from using less text so less indexing which isn't really a permanent solution just a minor one
|
||||
//about 2 seconds came from the async db stuff and the rest was from using less text so less indexing which isn't really a permanent solution just a workaround
|
||||
2020-01-23 16:57:57.0422|INFO|Seeder|75 Users seeded in 2398 ms
|
||||
2020-01-23 16:58:11.9983|INFO|Seeder|500 Widgets seeded in 14958 ms
|
||||
|
||||
@@ -20,7 +20,7 @@ TODO: Search indexing is painfully slow, it accounts for 16 of 22 seconds when c
|
||||
- Re-code it not using EF but directly interacting with the DB
|
||||
- Maybe it's a case for stored procedures or something?
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
TODO: DataFilter how to distinguish between filtering on specific ID value or on value column
|
||||
|
||||
@@ -176,7 +176,7 @@ namespace AyaNova.Api.Controllers
|
||||
/// <param name="apiVersion">Automatically filled from route path, no need to specify in body</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> PostWidget([FromBody] Widget inObj, ApiVersion apiVersion)
|
||||
public IActionResult PostWidget([FromBody] Widget inObj, ApiVersion apiVersion)
|
||||
{
|
||||
if (!serverState.IsOpen)
|
||||
return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
|
||||
@@ -192,7 +192,7 @@ namespace AyaNova.Api.Controllers
|
||||
return BadRequest(new ApiErrorResponse(ModelState));
|
||||
|
||||
//Create and validate
|
||||
Widget o = await biz.CreateAsync(inObj);
|
||||
Widget o = biz.Create(inObj);
|
||||
if (o == null)
|
||||
return BadRequest(new ApiErrorResponse(biz.Errors));
|
||||
else
|
||||
|
||||
@@ -458,7 +458,7 @@ namespace AyaNova.Biz
|
||||
|
||||
/// <summary>
|
||||
/// Process the keywords into the dictionary
|
||||
/// NOTE: NAME parameter is in ADDITION to the NAME also being on of the strings passed in text parameter
|
||||
/// NOTE: NAME parameter is in ADDITION to the NAME also being one of the strings passed in text parameter
|
||||
/// </summary>
|
||||
private static void ProcessKeywords(SearchIndexProcessObjectParameters p, bool newRecord)//long localeId, long objectID, AyaType objectType, string name, params string[] text)
|
||||
{
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace AyaNova.Biz
|
||||
|
||||
|
||||
//route linked version for external api access
|
||||
internal async Task<Widget> CreateAsync(Widget inObj)
|
||||
internal Widget Create(Widget inObj)
|
||||
{
|
||||
Validate(inObj, null);
|
||||
if (HasErrors)
|
||||
@@ -83,22 +83,14 @@ namespace AyaNova.Biz
|
||||
outObj.Tags = TagUtil.NormalizeTags(outObj.Tags);
|
||||
outObj.CustomFields = JsonUtil.CompactJson(outObj.CustomFields);
|
||||
|
||||
//Save to db
|
||||
var TheContext = ct;
|
||||
if (TheContext == null)
|
||||
TheContext = ServiceProviderProvider.DBContext;
|
||||
//TEST SPEED IMPROVEMENTS
|
||||
|
||||
//ORIGINALLY
|
||||
// await TheContext.Widget.AddAsync(outObj);
|
||||
// await TheContext.SaveChangesAsync();
|
||||
|
||||
//Save to db
|
||||
|
||||
//add syncronously and don't save but let the log save
|
||||
//THIS SAVED 1 SECOND OUT OF 22 for seeding 500 widgets
|
||||
TheContext.Widget.Add(outObj);
|
||||
ct.Widget.Add(outObj);
|
||||
|
||||
//Handle child and associated items:
|
||||
EventLogProcessor.LogEventToDatabaseAndSaveEntireContext(new Event(UserId, outObj.Id, BizType, AyaEvent.Created), TheContext);
|
||||
EventLogProcessor.LogEventToDatabaseAndSaveEntireContext(new Event(UserId, outObj.Id, BizType, AyaEvent.Created), ct);
|
||||
|
||||
|
||||
//This takes 16 seconds out of 22 when seeding 500 widgets
|
||||
@@ -106,7 +98,7 @@ namespace AyaNova.Biz
|
||||
|
||||
|
||||
//This takes 2 seconds out of 22 when seeding 500 widgets
|
||||
TagUtil.ProcessUpdateTagsInRepository(TheContext, outObj.Tags, null);
|
||||
TagUtil.ProcessUpdateTagsInRepository(ct, outObj.Tags, null);
|
||||
|
||||
return outObj;
|
||||
}
|
||||
|
||||
@@ -622,7 +622,7 @@ namespace AyaNova.Util
|
||||
//var NewObject = Cached_WidgetBiz.CreateAsync(o).Result;
|
||||
//test without cached widgetbiz
|
||||
WidgetBiz biz = WidgetBiz.GetBizInternal(ServiceProviderProvider.DBContext);
|
||||
var NewObject = biz.CreateAsync(o).Result;
|
||||
var NewObject = biz.Create(o);
|
||||
if (NewObject == null)
|
||||
{
|
||||
log.LogError($"Seeder::GenSeedWidget error creating widget {o.Name}\r\n" + biz.GetErrorsAsString());
|
||||
|
||||
Reference in New Issue
Block a user