Fix RemoveOldNotificationsWorker.cs: RemoveRange

This commit is contained in:
2025-07-03 21:57:07 +02:00
parent 84940c414c
commit cf2dbeaf6a

View File

@ -11,7 +11,7 @@ public class RemoveOldNotificationsWorker(TimeSpan? interval = null, IEnumerable
protected override BaseWorker[] DoWorkInternal() protected override BaseWorker[] DoWorkInternal()
{ {
IQueryable<Notification> toRemove = DbContext.Notifications.Where(n => n.IsSent || DateTime.UtcNow - n.Date > Interval); IQueryable<Notification> toRemove = DbContext.Notifications.Where(n => n.IsSent || DateTime.UtcNow - n.Date > Interval);
DbContext.Remove(toRemove); DbContext.RemoveRange(toRemove);
DbContext.Sync(); DbContext.Sync();
return []; return [];
} }