diff --git a/devdocs/todo.txt b/devdocs/todo.txt index 04ac545d..2f494eca 100644 --- a/devdocs/todo.txt +++ b/devdocs/todo.txt @@ -30,13 +30,23 @@ IMMEDIATE ITEMS: - Search and search text indexing - - Update all the seeder code to add search indexing so can properly test huge search datasets - - Current item is widgets - - Need to find a way to add random text to Notes fields that varies but has some overlap ideally - + - Create a test for search that searches the widgets LOREM text with huge dataset for performance testing - bugbug: why is the single letter a being indexed? Missing shortness filter, A not in stopwords for english?? - Update all the other routes to include search indexing (attachments, tags etc, anything with text in it) - + + - SEEDER + - Is generating non-unique names causing crash due to validation error. Add uniqufication code, maybe just a serial number + - PAINFULLY slow to generate widgets, the db ops are taking orders of magnitude too long, can any db steps be saved?? + - BUG BUG: 2018-09-26 16:47:34.3677|INFO|Seeder|Seeding 100 user(s) + 2018-09-26 16:47:34.4053|INFO|Seeder|Seeding 100 user(s) + 2018-09-26 16:47:34.4468|INFO|Seeder|Seeding 20000 Widget(s) + 2018-09-26 16:47:34.5704|INFO|Seeder|Seeding completed successfully + 2018-09-26 16:47:34.5704|INFO|Seeder|Seeder: setting server state back to Open + 2018-09-26 16:47:34.5704|INFO|AyaNova.Startup|BOOT: COMPLETED - SERVER IS NOW OPEN + 2018-09-26 16:47:47.0091|INFO|Seeder|User seeding completed + 2018-09-26 16:47:47.0864|INFO|Seeder|User seeding completed + It's not awaiting the generation and instead is opening the server immediately and saying seeding completed when it isn't + - EventLogProcessor.AddEntry: CHANGE this to save the context itself and then change all callers to handle that (remove save) - I originally didn't have the save in there because I thought subsequent code might all share in the single context save, however that's impossible as things like the search indexing require a save to harvest id's so it's not actually saving any time just adding complexity diff --git a/server/AyaNova/Startup.cs b/server/AyaNova/Startup.cs index fa1df9c5..c213d4cb 100644 --- a/server/AyaNova/Startup.cs +++ b/server/AyaNova/Startup.cs @@ -343,7 +343,7 @@ namespace AyaNova context.Request.HttpContext.Items["AY_USER_ID"] = u.id; context.Request.HttpContext.Items["AY_LOCALE_ID"] = u.localeId; - + } await next.Invoke(); @@ -405,7 +405,8 @@ namespace AyaNova if (TESTING_REFRESH_DB) { AyaNova.Core.License.Fetch(apiServerState, dbContext, _log); - Util.Seeder.SeedDatabase(Util.Seeder.SeedLevel.SmallOneManShopTrialDataSet); + //Util.Seeder.SeedDatabase(Util.Seeder.SeedLevel.SmallOneManShopTrialDataSet); + Util.Seeder.SeedDatabase(Util.Seeder.SeedLevel.LargeCorporateMultiRegionalTrialDataSet); } //TESTING #endif diff --git a/server/AyaNova/util/Seeder.cs b/server/AyaNova/util/Seeder.cs index b4771086..197f4ff3 100644 --- a/server/AyaNova/util/Seeder.cs +++ b/server/AyaNova/util/Seeder.cs @@ -241,6 +241,7 @@ namespace AyaNova.Util public async static void GenSeedUser(ILogger log, int count, AuthorizationRoles roles, UserType userType, bool active = true, string login = null, string password = null) { + log.LogInformation($"Seeding {count.ToString()} user(s)"); UserBiz Biz = UserBiz.GetBizInternal(ServiceProviderProvider.DBContext); //allow creation of not entirely ready users (missing client id or subcontractor vendor id etc) Biz.SeedOrImportRelaxedRulesMode = true; @@ -281,7 +282,7 @@ namespace AyaNova.Util throw new System.Exception("Seeder::GenSeedUser error creating user\r\n" + Biz.GetErrorsAsString()); } } - + log.LogInformation("User seeding completed"); } ////////////////////////////////////////////////////// @@ -289,6 +290,7 @@ namespace AyaNova.Util // public static async void GenSeedWidget(ILogger log, int count) { + log.LogInformation($"Seeding {count.ToString()} Widget(s)"); //get a context just for this op to save memory on changetracking //AyContext ct = ServiceProviderProvider.DBContext; WidgetBiz Biz = WidgetBiz.GetBizInternal(ServiceProviderProvider.DBContext); @@ -296,7 +298,7 @@ namespace AyaNova.Util for (int x = 0; x < count; x++) { Widget o = new Widget(); - o.Name = f.Commerce.ProductName(); + o.Name = f.Commerce.ProductName() + x.ToString(); o.Active = true; o.StartDate = f.Date.Between(DateTime.Now, DateTime.Now.AddMinutes(60)); o.EndDate = f.Date.Between(DateTime.Now.AddMinutes(90), DateTime.Now.AddHours(5)); @@ -312,6 +314,7 @@ namespace AyaNova.Util throw new System.Exception("Seeder::GenSeedWidget error creating widget\r\n" + Biz.GetErrorsAsString()); } } + log.LogInformation("Widget seeding completed"); } }//eoc