cleanup orphaned rules

This commit is contained in:
Collin Barrett 2018-08-27 17:22:40 -05:00
parent 7471f0a9c8
commit e22144010e

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();
}