Example #1
0
        private async Task RunTest(IUpsertRepository repo, params int[] counts)
        {
            var start = 0;

            foreach (var count in counts)
            {
                try
                {
                    var sw   = Stopwatch.StartNew();
                    var task = Enumerable.Range(start, count)
                               .ToObservable()
                               .Select(i => Observable.FromAsync(() => repo.UpsertAsync(i, i * 100)))
                               .Merge(1000)
                               .ToTask();
                    await task;
                    _testOutputHelper.WriteLine($"time : {sw.ElapsedMilliseconds}");
                    await Task.Delay(TimeSpan.FromMilliseconds(10));

                    start += count;
                }
                catch (Exception e)
                {
                    _testOutputHelper.WriteLine($"there is an error : {e}");
                }
            }
        }
 public CreateBagsCountByBrandsCommandHandler(ILinqSearchRepository <Bag> searchRepository, IUpsertRepository <Dashboard <IEnumerable <CountBy <RefValue> > > > upsertRepository)
 {
     SearchRepository = searchRepository ?? throw new System.ArgumentNullException(nameof(searchRepository));
     UpsertRepository = upsertRepository ?? throw new System.ArgumentNullException(nameof(upsertRepository));
 }
Example #3
0
 public CreateTotalBagsCountByInsertDateCommandHandler(ILinqSearchRepository <Bag> searchRepository, IUpsertRepository <Dashboard <IEnumerable <CountBy <NodaTime.LocalDate> > > > upsertRepository)
 {
     SearchRepository = searchRepository ?? throw new System.ArgumentNullException(nameof(searchRepository));
     UpsertRepository = upsertRepository ?? throw new System.ArgumentNullException(nameof(upsertRepository));
 }