This commit is contained in:
2020-07-15 23:16:50 +00:00
parent 8a88108248
commit 222ddd7077

View File

@@ -29,7 +29,7 @@ namespace AyaNova.Biz
if (DateTime.UtcNow - lastSweep < SWEEP_EVERY_INTERVAL)
return;
DateTime dtDeleteCutoff = DateTime.UtcNow - DELETE_AFTER_AGE;
DateTime dtPastEventCutoff=DateTime.UtcNow-SWEEP_EVERY_INTERVAL;
DateTime dtPastEventCutoff = DateTime.UtcNow - SWEEP_EVERY_INTERVAL;
log.LogTrace("Sweep starting");
using (AyContext ct = AyaNova.Util.ServiceProviderProvider.DBContext)
@@ -44,6 +44,9 @@ namespace AyaNova.Biz
//then deletes it if created more than 90 days ago (pretty sure there are no back dated events, once it's passed it's past)
await ct.Database.ExecuteSqlInterpolatedAsync($"delete from anotifyevent where eventdate < {dtPastEventCutoff} and created < {dtDeleteCutoff}");
//NotifyDeliveryLog - deletes all log items older than 90 days
await ct.Database.ExecuteSqlInterpolatedAsync($"delete from anotifydeliverylog where processed < {dtDeleteCutoff}");
}
lastSweep = DateTime.UtcNow;
}