mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
cleanup failed snapshots
This commit is contained in:
parent
f7943e665f
commit
94cc20bf62
1 changed files with 7 additions and 0 deletions
|
|
@ -23,6 +23,7 @@ public SnapshotService(FilterListsDbContext dbContext, IConfigurationProvider ma
|
|||
|
||||
public async Task CaptureAsync(int batchSize)
|
||||
{
|
||||
await CleanupFailedSnapshots();
|
||||
uaString = await UserAgentService.GetMostPopularString();
|
||||
var lists = await GetListsToCapture(batchSize);
|
||||
var snaps = await CreateAndSaveSnaps<Snapshot>(lists);
|
||||
|
|
@ -30,6 +31,12 @@ public async Task CaptureAsync(int batchSize)
|
|||
await CreateAndSaveSnaps<SnapshotWayback>(listsToRetry);
|
||||
}
|
||||
|
||||
private async Task CleanupFailedSnapshots()
|
||||
{
|
||||
DbContext.SnapshotRules.RemoveRange(DbContext.SnapshotRules.Where(sr => !sr.Snapshot.WasSuccessful));
|
||||
await DbContext.SaveChangesAsync();
|
||||
}
|
||||
|
||||
private async Task<IEnumerable<FilterListViewUrlDto>> GetListsToCapture(int batchSize) =>
|
||||
await DbContext
|
||||
.FilterLists
|
||||
|
|
|
|||
Loading…
Reference in a new issue