aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server.Implementations/Item/ChapterRepository.cs
diff options
context:
space:
mode:
authorChristopher Young <c.t.ythegamer@gmail.com>2025-11-08 07:31:02 -0700
committerChristopher Young <c.t.ythegamer@gmail.com>2025-11-08 07:31:02 -0700
commit4cb038574515590611af081b5fe341ff4cb840b2 (patch)
tree847f90cd0fd7db9b7845d0afafdabedd3ecf3b74 /Jellyfin.Server.Implementations/Item/ChapterRepository.cs
parent438d992c8b0522f6a17f437ee991c8ef6808d749 (diff)
parent1adf441f1ca9d61c3d6c63df0ea87a870e03632f (diff)
Merge branch 'master' of https://github.com/JadedRain/jellyfin
Diffstat (limited to 'Jellyfin.Server.Implementations/Item/ChapterRepository.cs')
-rw-r--r--Jellyfin.Server.Implementations/Item/ChapterRepository.cs13
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)