diff --git a/Jellyfin.Server.Implementations/Activity/ActivityManager.cs b/Jellyfin.Server.Implementations/Activity/ActivityManager.cs index ce1c54cbb2..54272aeafa 100644 --- a/Jellyfin.Server.Implementations/Activity/ActivityManager.cs +++ b/Jellyfin.Server.Implementations/Activity/ActivityManager.cs @@ -68,7 +68,6 @@ namespace Jellyfin.Server.Implementations.Activity Date = entity.DateCreated, Severity = entity.LogSeverity }) - .AsQueryable() .ToListAsync() .ConfigureAwait(false)); } @@ -80,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); } } diff --git a/Jellyfin.Server.Implementations/Security/AuthenticationManager.cs b/Jellyfin.Server.Implementations/Security/AuthenticationManager.cs index b2dfe60a14..07ac27e3c2 100644 --- a/Jellyfin.Server.Implementations/Security/AuthenticationManager.cs +++ b/Jellyfin.Server.Implementations/Security/AuthenticationManager.cs @@ -58,19 +58,10 @@ namespace Jellyfin.Server.Implementations.Security var dbContext = await _dbProvider.CreateDbContextAsync().ConfigureAwait(false); await using (dbContext.ConfigureAwait(false)) { - var key = await dbContext.ApiKeys + await dbContext.ApiKeys .Where(apiKey => apiKey.AccessToken == accessToken) - .FirstOrDefaultAsync() + .ExecuteDeleteAsync() .ConfigureAwait(false); - - if (key is null) - { - return; - } - - dbContext.Remove(key); - - await dbContext.SaveChangesAsync().ConfigureAwait(false); } } }