Use ExecuteDelete for cleaning activity logs

This commit is contained in:
Patrick Barron 2023-11-22 09:35:35 -05:00
parent 6b940e141e
commit c9c133bc43

View File

@ -79,11 +79,10 @@ namespace Jellyfin.Server.Implementations.Activity
var dbContext = await _provider.CreateDbContextAsync().ConfigureAwait(false); var dbContext = await _provider.CreateDbContextAsync().ConfigureAwait(false);
await using (dbContext.ConfigureAwait(false)) await using (dbContext.ConfigureAwait(false))
{ {
var entries = dbContext.ActivityLogs await dbContext.ActivityLogs
.Where(entry => entry.DateCreated <= startDate); .Where(entry => entry.DateCreated <= startDate)
.ExecuteDeleteAsync()
dbContext.RemoveRange(entries); .ConfigureAwait(false);
await dbContext.SaveChangesAsync().ConfigureAwait(false);
} }
} }