public async Task PatchAllBulkConcurrentlyAsync() { Log.SetLogLevel <DailyLogEventRepository>(LogLevel.Warning); const int COUNT = 1000 * 10; int added = 0; do { await _dailyRepository.AddAsync(LogEventGenerator.GenerateLogs(1000)); added += 1000; } while (added < COUNT); await _client.RefreshAsync(Indices.All); Log.SetLogLevel <DailyLogEventRepository>(LogLevel.Trace); var tasks = Enumerable.Range(1, 6).Select(async i => { Assert.Equal(COUNT, await _dailyRepository.IncrementValueAsync(new string[0], i)); }); await Task.WhenAll(tasks); var events = await _dailyRepository.GetAllAsync(); foreach (var ev in events.Documents) { Assert.Equal(21, ev.Value); } }
public async Task PatchAllBulkAsync() { Log.SetLogLevel <DailyLogEventRepository>(LogLevel.Warning); const int COUNT = 1000 * 10; int added = 0; do { await _dailyRepository.AddAsync(LogEventGenerator.GenerateLogs(1000), o => o.ImmediateConsistency(true)); added += 1000; } while (added < COUNT); Log.SetLogLevel <DailyLogEventRepository>(LogLevel.Trace); Assert.Equal(COUNT, await _dailyRepository.IncrementValueAsync(new string[0])); }