mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
async AddOrUpdateRules()
This commit is contained in:
parent
bb986e853f
commit
43ab7c8df2
1 changed files with 3 additions and 3 deletions
|
|
@ -25,7 +25,7 @@ public async Task ScrapeAsync(int batchSize)
|
|||
{
|
||||
var lists = await GetNextFilterListsToScrape(batchSize);
|
||||
var snapshots = await GetSnapshots(lists);
|
||||
snapshots.ForEach(AddOrUpdateRules);
|
||||
snapshots.ForEach(async snapshot => await AddOrUpdateRules(snapshot));
|
||||
}
|
||||
|
||||
private async Task<IEnumerable<FilterListViewUrlDto>> GetNextFilterListsToScrape(int batchSize)
|
||||
|
|
@ -66,7 +66,7 @@ private static async Task<string> GetHttpResponseMessageContent(string url)
|
|||
return null;
|
||||
}
|
||||
|
||||
private void AddOrUpdateRules(Snapshot snapshot)
|
||||
private async Task AddOrUpdateRules(Snapshot snapshot)
|
||||
{
|
||||
// add new Rules
|
||||
var preExistingSnapshotRules = dbContext.Rules.Where(x => snapshot.RawRules.Contains(x.Raw));
|
||||
|
|
@ -96,7 +96,7 @@ private void AddOrUpdateRules(Snapshot snapshot)
|
|||
list.ScrapedDateUtc = DateTime.UtcNow;
|
||||
dbContext.FilterLists.Update(list);
|
||||
|
||||
dbContext.SaveChanges();
|
||||
await dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
||||
private class FilterListViewUrlDto
|
||||
|
|
|
|||
Loading…
Reference in a new issue