aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaus Vium <cvium@users.noreply.github.com>2023-11-23 22:31:01 +0100
committerGitHub <noreply@github.com>2023-11-23 22:31:01 +0100
commitf19492c1de848642926b63b29ce78a65ca78f421 (patch)
treef0eb21b4cf1e3ba51b2f10e8848d9092f6f90df3
parent3d4d33bcbac07be40c132cf3a3c39630ace7b444 (diff)
parentad58d1f77c2039a62b225545fb795d3395046303 (diff)
Merge pull request #10617 from barronpm/query-improvements
Query Improvements
-rw-r--r--Jellyfin.Server.Implementations/Activity/ActivityManager.cs10
-rw-r--r--Jellyfin.Server.Implementations/Security/AuthenticationManager.cs13
2 files changed, 6 insertions, 17 deletions
diff --git a/Jellyfin.Server.Implementations/Activity/ActivityManager.cs b/Jellyfin.Server.Implementations/Activity/ActivityManager.cs
index ce1c54cbb..54272aeaf 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 b2dfe60a1..07ac27e3c 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);
}
}
}