Apply review comments

This commit is contained in:
Shadowghost 2026-03-30 00:12:35 +02:00
parent 98bbc26c5e
commit acaeba11f3
2 changed files with 7 additions and 10 deletions

View file

@ -182,12 +182,6 @@ public class MediaSegmentManager : IMediaSegmentManager
/// <inheritdoc /> /// <inheritdoc />
public async Task DeleteSegmentsAsync(Guid itemId, CancellationToken cancellationToken) public async Task DeleteSegmentsAsync(Guid itemId, CancellationToken cancellationToken)
{ {
var db = await _dbProvider.CreateDbContextAsync(cancellationToken).ConfigureAwait(false);
await using (db.ConfigureAwait(false))
{
await db.MediaSegments.Where(e => e.ItemId.Equals(itemId)).ExecuteDeleteAsync(cancellationToken).ConfigureAwait(false);
}
foreach (var provider in _segmentProviders) foreach (var provider in _segmentProviders)
{ {
try try
@ -199,6 +193,12 @@ public class MediaSegmentManager : IMediaSegmentManager
_logger.LogError(ex, "Provider {ProviderName} failed to clean up extracted data for item {ItemId}", provider.Name, itemId); _logger.LogError(ex, "Provider {ProviderName} failed to clean up extracted data for item {ItemId}", provider.Name, itemId);
} }
} }
var db = await _dbProvider.CreateDbContextAsync(cancellationToken).ConfigureAwait(false);
await using (db.ConfigureAwait(false))
{
await db.MediaSegments.Where(e => e.ItemId.Equals(itemId)).ExecuteDeleteAsync(cancellationToken).ConfigureAwait(false);
}
} }
/// <inheritdoc /> /// <inheritdoc />

View file

@ -40,8 +40,5 @@ public interface IMediaSegmentProvider
/// <param name="itemId">The item whose data is being pruned.</param> /// <param name="itemId">The item whose data is being pruned.</param>
/// <param name="cancellationToken">Abort token.</param> /// <param name="cancellationToken">Abort token.</param>
/// <returns>A task representing the asynchronous cleanup operation.</returns> /// <returns>A task representing the asynchronous cleanup operation.</returns>
Task CleanupExtractedData(Guid itemId, CancellationToken cancellationToken) Task CleanupExtractedData(Guid itemId, CancellationToken cancellationToken);
{
return Task.CompletedTask;
}
} }