From c9c133bc43231609a237291ae40ecb57bfc2576d Mon Sep 17 00:00:00 2001 From: Patrick Barron Date: Wed, 22 Nov 2023 09:35:35 -0500 Subject: [PATCH] Use ExecuteDelete for cleaning activity logs --- .../Activity/ActivityManager.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Jellyfin.Server.Implementations/Activity/ActivityManager.cs b/Jellyfin.Server.Implementations/Activity/ActivityManager.cs index a2ea6b225..54272aeaf 100644 --- a/Jellyfin.Server.Implementations/Activity/ActivityManager.cs +++ b/Jellyfin.Server.Implementations/Activity/ActivityManager.cs @@ -79,11 +79,10 @@ namespace Jellyfin.Server.Implementations.Activity var dbContext = await _provider.CreateDbContextAsync().ConfigureAwait(false); await using (dbContext.ConfigureAwait(false)) { - var entries = dbContext.ActivityLogs - .Where(entry => entry.DateCreated <= startDate); - - dbContext.RemoveRange(entries); - await dbContext.SaveChangesAsync().ConfigureAwait(false); + await dbContext.ActivityLogs + .Where(entry => entry.DateCreated <= startDate) + .ExecuteDeleteAsync() + .ConfigureAwait(false); } }