Revert "lazy-create batches"

This reverts commit 66bba40bcc.
This commit is contained in:
Collin Barrett 2018-08-25 10:07:31 -05:00
parent 66bba40bcc
commit 5af77aee97

View file

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading;
@ -119,14 +120,21 @@ private async Task GetLines()
}
private async Task SaveInBatches()
{
var snapBatches = await CreateBatches();
SaveBatches(snapBatches);
}
private async Task<IEnumerable<Batch>> CreateBatches()
{
SnapEntity.BatchSize = await batchSizeService.GetBatchSize();
var lineBatches = lines.Batch(SnapEntity.BatchSize.Value);
foreach (var lineBatch in lineBatches)
{
var batch = new Batch(dbContext, lineBatch, SnapEntity);
return lines.Batch(SnapEntity.BatchSize.Value).Select(b => new Batch(dbContext, b, SnapEntity));
}
private static void SaveBatches(IEnumerable<Batch> batches)
{
foreach (var batch in batches)
batch.Save();
}
}
private async Task SetSuccessful()