public async Task CollectAsync(CounterKey key, CounterMap counters, CancellationToken ct = default) { if (key.AppId != null) { await collector.AddAsync(key.AppId, counters); } }
public async Task Should_batch_writes() { var log = A.Fake <ILogger>(); var longDelay = new CounterCollector <string>(store, log, 100, 10, 10000); for (var i = 0; i < 100; i++) { var key = i.ToString(CultureInfo.InvariantCulture); await longDelay.AddAsync(key, new CounterMap()); } await longDelay.DisposeAsync(); A.CallTo(() => store.BatchWriteAsync(A <List <(string, CounterMap)> > .That.Matches(x => x.Count == 10), default))