cleanup orphaned rules

This commit is contained in:
Collin M. Barrett 2018-08-27 17:22:40 -05:00
parent b6ea968e8c
commit d226564eb0

View file

@ -33,6 +33,7 @@ public async Task CaptureAsync(int batchSize)
private async Task CleanupFailedSnapshots()
{
DbContext.RemoveRange(DbContext.SnapshotRules.Where(sr => !sr.Snapshot.WasSuccessful));
DbContext.RemoveRange(DbContext.Rules.Where(r => !r.SnapshotRules.Any()));
await DbContext.SaveChangesAsync();
}