Tweak Trickplay migration for speed (#12643)

This commit is contained in:
Cody Robibero
2024-09-23 09:09:23 -06:00
committed by GitHub
parent 0539fdc5e3
commit 3c639c2e80
4 changed files with 83 additions and 39 deletions

View File

@@ -455,16 +455,18 @@ public class TrickplayManager : ITrickplayManager
}
/// <inheritdoc />
public async Task<IReadOnlyList<Guid>> GetTrickplayItemsAsync()
public async Task<IReadOnlyList<TrickplayInfo>> GetTrickplayItemsAsync(int limit, int offset)
{
List<Guid> trickplayItems;
IReadOnlyList<TrickplayInfo> trickplayItems;
var dbContext = await _dbProvider.CreateDbContextAsync().ConfigureAwait(false);
await using (dbContext.ConfigureAwait(false))
{
trickplayItems = await dbContext.TrickplayInfos
.AsNoTracking()
.Select(i => i.ItemId)
.OrderBy(i => i.ItemId)
.Skip(offset)
.Take(limit)
.ToListAsync()
.ConfigureAwait(false);
}