mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
parent
fe8927064f
commit
b202501011
1 changed files with 7 additions and 4 deletions
|
|
@ -33,7 +33,7 @@ public SnapshotService(FilterListsDbContext dbContext, IConfigurationProvider ma
|
|||
|
||||
public async Task CaptureAsync(int batchSize)
|
||||
{
|
||||
//await CleanupFailedSnapshots();
|
||||
await CleanupFailedSnapshots();
|
||||
uaString = await UserAgentService.GetMostPopularString();
|
||||
var lists = await GetListsToCapture(batchSize);
|
||||
var snaps = await CreateAndSaveSnaps<Snapshot>(lists);
|
||||
|
|
@ -41,11 +41,14 @@ public async Task CaptureAsync(int batchSize)
|
|||
await CreateAndSaveSnaps<SnapshotWayback>(listsToRetry);
|
||||
}
|
||||
|
||||
//TODO: speed this up, too slow, loads all into memory
|
||||
private async Task CleanupFailedSnapshots()
|
||||
{
|
||||
DbContext.RemoveRange(DbContext.SnapshotRules.Where(sr => !sr.Snapshot.WasSuccessful));
|
||||
await DbContext.SaveChangesAsync();
|
||||
const string command =
|
||||
@"DELETE snapshots_rules
|
||||
FROM snapshots_rules
|
||||
JOIN snapshots ON snapshots.Id = snapshots_rules.SnapshotId
|
||||
WHERE snapshots.WasSuccessful = 0;";
|
||||
await DbContext.Database.ExecuteSqlCommandAsync(command);
|
||||
}
|
||||
|
||||
private async Task<IEnumerable<FilterListViewUrlDto>> GetListsToCapture(int batchSize) =>
|
||||
|
|
|
|||
Loading…
Reference in a new issue