mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
de-async batch saving to try reducing crashes
This commit is contained in:
parent
676f7807d8
commit
75a37df108
2 changed files with 5 additions and 5 deletions
|
|
@ -20,11 +20,11 @@ public Batch(FilterListsDbContext dbContext, IEnumerable<string> lines, Data.Ent
|
|||
this.snapEntity = snapEntity;
|
||||
}
|
||||
|
||||
public async Task SaveAsync()
|
||||
public void Save()
|
||||
{
|
||||
var rules = GetOrCreateRules();
|
||||
CreateSnapRules(rules);
|
||||
await dbContext.SaveChangesAsync();
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
|
||||
private IQueryable<Rule> GetOrCreateRules()
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ private async Task GetLines()
|
|||
private async Task SaveInBatches()
|
||||
{
|
||||
var snapBatches = await CreateBatches();
|
||||
await SaveBatches(snapBatches);
|
||||
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 async Task SaveBatches(IEnumerable<Batch> batches)
|
||||
private static void SaveBatches(IEnumerable<Batch> batches)
|
||||
{
|
||||
foreach (var batch in batches)
|
||||
await batch.SaveAsync();
|
||||
batch.Save();
|
||||
}
|
||||
|
||||
private async Task SetSuccessful()
|
||||
|
|
|
|||
Loading…
Reference in a new issue