aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShadowghost <Ghost_of_Stone@web.de>2026-05-13 13:47:07 +0200
committerShadowghost <Ghost_of_Stone@web.de>2026-05-13 13:47:07 +0200
commit38bda65ca9a5994d8e8feb0cd239d88e080a90b8 (patch)
treed667a5936bc197304954f184b4b5c9a8f7e2106d
parent5165e4e2d421b2358582f691090ceb4bb220745e (diff)
Properly handle cancellation in MediaSegmentManager
-rw-r--r--Jellyfin.Server.Implementations/MediaSegments/MediaSegmentManager.cs14
1 files changed, 14 insertions, 0 deletions
diff --git a/Jellyfin.Server.Implementations/MediaSegments/MediaSegmentManager.cs b/Jellyfin.Server.Implementations/MediaSegments/MediaSegmentManager.cs
index 249df476a0..61c028b685 100644
--- a/Jellyfin.Server.Implementations/MediaSegments/MediaSegmentManager.cs
+++ b/Jellyfin.Server.Implementations/MediaSegments/MediaSegmentManager.cs
@@ -81,6 +81,11 @@ public class MediaSegmentManager : IMediaSegmentManager
foreach (var provider in providers)
{
+ if (cancellationToken.IsCancellationRequested)
+ {
+ break;
+ }
+
if (!await provider.Supports(baseItem).ConfigureAwait(false))
{
_logger.LogDebug("Media Segment provider {ProviderName} does not support item with path {MediaPath}", provider.Name, baseItem.Path);
@@ -146,6 +151,15 @@ public class MediaSegmentManager : IMediaSegmentManager
await CreateSegmentAsync(segment, providerId).ConfigureAwait(false);
}
}
+ catch (OperationCanceledException) when (cancellationToken.IsCancellationRequested)
+ {
+ throw;
+ }
+ catch (Exception ex) when (cancellationToken.IsCancellationRequested)
+ {
+ _logger.LogDebug(ex, "Provider {ProviderName} aborted segment extraction for {MediaPath} due to shutdown", provider.Name, baseItem.Path);
+ break;
+ }
catch (Exception ex)
{
_logger.LogError(ex, "Provider {ProviderName} failed to extract segments from {MediaPath}", provider.Name, baseItem.Path);