diff options
| author | Logan Douglas <42654828+JadedRain@users.noreply.github.com> | 2025-10-31 13:06:17 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-31 13:06:17 -0600 |
| commit | 490bf347cbdf8ec458996d09ba40651eb647b7b9 (patch) | |
| tree | 1bdad774667bf5e69f3fe7397a27f631a5ca617a /Jellyfin.Server.Implementations/Item/ChapterRepository.cs | |
| parent | fd6e48603bcf143a1bbc3b1bda26a8e1664f9379 (diff) | |
| parent | 23929a3e709f4324d49271c02b0b047e1149e860 (diff) | |
Merge branch 'jellyfin:master' into master
Diffstat (limited to 'Jellyfin.Server.Implementations/Item/ChapterRepository.cs')
| -rw-r--r-- | Jellyfin.Server.Implementations/Item/ChapterRepository.cs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/Jellyfin.Server.Implementations/Item/ChapterRepository.cs b/Jellyfin.Server.Implementations/Item/ChapterRepository.cs index e0d23a2613..98700f3224 100644 --- a/Jellyfin.Server.Implementations/Item/ChapterRepository.cs +++ b/Jellyfin.Server.Implementations/Item/ChapterRepository.cs @@ -1,6 +1,8 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Threading; +using System.Threading.Tasks; using Jellyfin.Database.Implementations; using Jellyfin.Database.Implementations.Entities; using MediaBrowser.Controller.Drawing; @@ -82,11 +84,14 @@ public class ChapterRepository : IChapterRepository } /// <inheritdoc /> - public void DeleteChapters(Guid itemId) + public async Task DeleteChaptersAsync(Guid itemId, CancellationToken cancellationToken) { - using var context = _dbProvider.CreateDbContext(); - context.Chapters.Where(c => c.ItemId.Equals(itemId)).ExecuteDelete(); - context.SaveChanges(); + var dbContext = await _dbProvider.CreateDbContextAsync(cancellationToken).ConfigureAwait(false); + await using (dbContext.ConfigureAwait(false)) + { + await dbContext.Chapters.Where(c => c.ItemId.Equals(itemId)).ExecuteDeleteAsync(cancellationToken).ConfigureAwait(false); + await dbContext.SaveChangesAsync(cancellationToken).ConfigureAwait(false); + } } private Chapter Map(ChapterInfo chapterInfo, int index, Guid itemId) |
