after perf improvements and experimentation

This commit is contained in:
2020-01-24 01:05:16 +00:00
parent 8edeae4c04
commit cf79c5e90c
4 changed files with 124 additions and 94 deletions

View File

@@ -87,13 +87,27 @@ namespace AyaNova.Biz
var TheContext = ct;
if (TheContext == null)
TheContext = ServiceProviderProvider.DBContext;
await TheContext.Widget.AddAsync(outObj);
await TheContext.SaveChangesAsync();
//TEST SPEED IMPROVEMENTS
//ORIGINALLY
// await TheContext.Widget.AddAsync(outObj);
// await TheContext.SaveChangesAsync();
//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);
//Handle child and associated items:
EventLogProcessor.LogEventToDatabaseAndSaveEntireContext(new Event(UserId, outObj.Id, BizType, AyaEvent.Created), TheContext);
//This takes 16 seconds out of 22 when seeding 500 widgets
SearchIndex(outObj, true);
TagUtil.ProcessUpdateTagsInRepository(TheContext, outObj.Tags, null);
//This takes 2 seconds out of 22 when seeding 500 widgets
TagUtil.ProcessUpdateTagsInRepository(TheContext, outObj.Tags, null);
return outObj;
}
}