public bool Do(string sessionId, int bunchSize) { Init(); _sessionId = sessionId; _randomizer.Buildup(bunchSize * 30, bunchSize * 600, bunchSize * 6000); var watch = new Stopwatch(); watch.Start(); try { var nextBunch = DoNextBunch(bunchSize); _pusherPregData.AddToSaveQueue(nextBunch); } catch (Exception e) { ConsoleWriteline("Got exception in DoNextBunch(): " + e.Message); throw; } watch.Stop(); ConsoleWriteline("Done with next bunch of " + bunchSize + ". It took " + watch.Elapsed.TotalMinutes + " minutes"); return(true); }
public async Task <int> ImportStaticData(HashSet <string> staticNinList, IPregDataProvider staticdataSource, IPushPregData targetPusher) { var person = await staticdataSource.GetNextPerson(); while (staticdataSource.HasMore()) { if (staticNinList.Contains(person.NIN)) { if (person.NewNIN == "") { person.NewNIN = null; } if (person.OldNIN == "") { person.OldNIN = null; } targetPusher.AddToSaveQueue(new List <Person> { person }); var wasAdded = IdControl.TakenAdd(person.NIN); if (!wasAdded) { throw new Exception("TakenAdd feilet. dette skal ikke skje siden input liste er kun unike. Sjekk at database var tom initielt"); } staticNinList.Remove(person.NIN); } person = await staticdataSource.GetNextPerson(); } Outputter.WriteLine("Done importing static data. Number of object not found in source was " + staticNinList.Count + ". Items are put on save queue. Length:" + targetPusher.QueueLength()); return(staticNinList.Count); }