Applied review comments

This commit is contained in:
JPVenson
2025-01-15 20:12:41 +00:00
parent d716a53ec2
commit b33810534b
7 changed files with 44 additions and 30 deletions

View File

@@ -67,10 +67,16 @@ namespace Emby.Server.Implementations.Data
progress.Report(percent * 100);
}
using var context = await _dbProvider.CreateDbContextAsync(cancellationToken).ConfigureAwait(false);
using var transaction = await context.Database.BeginTransactionAsync(cancellationToken).ConfigureAwait(false);
await context.ItemValues.Where(e => e.BaseItemsMap!.Count == 0).ExecuteDeleteAsync(cancellationToken).ConfigureAwait(false);
await transaction.CommitAsync(cancellationToken).ConfigureAwait(false);
var context = await _dbProvider.CreateDbContextAsync(cancellationToken).ConfigureAwait(false);
await using (context.ConfigureAwait(false))
{
var transaction = await context.Database.BeginTransactionAsync(cancellationToken).ConfigureAwait(false);
await using (transaction.ConfigureAwait(false))
{
await context.ItemValues.Where(e => e.BaseItemsMap!.Count == 0).ExecuteDeleteAsync(cancellationToken).ConfigureAwait(false);
await transaction.CommitAsync(cancellationToken).ConfigureAwait(false);
}
}
progress.Report(100);
}

View File

@@ -146,8 +146,8 @@ namespace Emby.Server.Implementations.Library
{
ItemId = itemId,
CustomDataKey = dto.Key,
Item = null!,
User = null!,
Item = null,
User = null,
AudioStreamIndex = dto.AudioStreamIndex,
IsFavorite = dto.IsFavorite,
LastPlayedDate = dto.LastPlayedDate,
@@ -181,7 +181,13 @@ namespace Emby.Server.Implementations.Library
private UserItemData? GetUserData(User user, Guid itemId, List<string> keys)
{
var cacheKey = GetCacheKey(user.InternalId, itemId);
var data = GetUserDataInternal(user.Id, itemId, keys);
if (_userData.TryGetValue(cacheKey, out var data))
{
return data;
}
data = GetUserDataInternal(user.Id, itemId, keys);
if (data is null)
{