Merge pull request #10617 from barronpm/query-improvements
Query Improvements
This commit is contained in:
commit
f19492c1de
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user