private async Task RepairAsync(DateTime lastGenerationTime, DateTime endTime, TimeResolution resolution, CancellationToken cancel) { var time = lastGenerationTime == DateTime.MinValue ? endTime.AddPeriods(-3, resolution) : lastGenerationTime.Next(resolution); var next = time.Next(resolution); //_logger.LogTrace($"Repairing aggregations. Time: {time}, Next: {next}, resolution {resolution}"); while (time < endTime.Truncate(resolution)) { await AggregateAsync(time, next, resolution, false, cancel); time = next; next = time.Next(resolution); } }