Revert "de-async batch saving to try reducing crashes"

This reverts commit 951a4b345a.
This commit is contained in:
Collin M. Barrett 2018-08-25 10:07:35 -05:00
parent 09eb5cf9e2
commit e97e36f6ef
2 changed files with 5 additions and 5 deletions

View file

@ -20,11 +20,11 @@ public Batch(FilterListsDbContext dbContext, IEnumerable<string> lines, Data.Ent
this.snapEntity = snapEntity;
}
public void Save()
public async Task SaveAsync()
{
var rules = GetOrCreateRules();
CreateSnapRules(rules);
dbContext.SaveChanges();
await dbContext.SaveChangesAsync();
}
private IQueryable<Rule> GetOrCreateRules()

View file

@ -122,7 +122,7 @@ private async Task GetLines()
private async Task SaveInBatches()
{
var snapBatches = await CreateBatches();
SaveBatches(snapBatches);
await SaveBatches(snapBatches);
}
private async Task<IEnumerable<Batch>> CreateBatches()
@ -131,10 +131,10 @@ private async Task<IEnumerable<Batch>> CreateBatches()
return lines.Batch(SnapEntity.BatchSize.Value).Select(b => new Batch(dbContext, b, SnapEntity));
}
private static void SaveBatches(IEnumerable<Batch> batches)
private static async Task SaveBatches(IEnumerable<Batch> batches)
{
foreach (var batch in batches)
batch.Save();
await batch.SaveAsync();
}
private async Task SetSuccessful()