aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNils Fürniß <contact@nalsai.de>2022-03-13 11:20:09 +0100
committerNils Fürniß <contact@nalsai.de>2022-03-22 19:17:49 +0100
commitd7d36a102aedf1801c8f76a0ead983c5a5a87ccd (patch)
tree6182256e049d824fc4eaa0440ab7f5aa3effd694
parentb4bb82b6d7537dde1ee868b1a1cf9d3652f83866 (diff)
Fix releasing lock
-rw-r--r--MediaBrowser.MediaEncoding/Attachments/AttachmentExtractor.cs26
1 files changed, 13 insertions, 13 deletions
diff --git a/MediaBrowser.MediaEncoding/Attachments/AttachmentExtractor.cs b/MediaBrowser.MediaEncoding/Attachments/AttachmentExtractor.cs
index 00aafa126..142571e8f 100644
--- a/MediaBrowser.MediaEncoding/Attachments/AttachmentExtractor.cs
+++ b/MediaBrowser.MediaEncoding/Attachments/AttachmentExtractor.cs
@@ -93,9 +93,9 @@ namespace MediaBrowser.MediaEncoding.Attachments
await semaphore.WaitAsync(cancellationToken).ConfigureAwait(false);
- if (!Directory.Exists(outputPath))
+ try
{
- try
+ if (!Directory.Exists(outputPath))
{
await ExtractAllAttachmentsInternal(
_mediaEncoder.GetInputArgument(inputFile, mediaSource),
@@ -103,10 +103,10 @@ namespace MediaBrowser.MediaEncoding.Attachments
false,
cancellationToken).ConfigureAwait(false);
}
- finally
- {
- semaphore.Release();
- }
+ }
+ finally
+ {
+ semaphore.Release();
}
}
@@ -120,26 +120,26 @@ namespace MediaBrowser.MediaEncoding.Attachments
await semaphore.WaitAsync(cancellationToken).ConfigureAwait(false);
- if (!File.Exists(Path.Join(outputPath, id)))
+ try
{
- try
+ if (!File.Exists(Path.Join(outputPath, id)))
{
await ExtractAllAttachmentsInternal(
inputArgument,
outputPath,
true,
cancellationToken).ConfigureAwait(false);
- }
- finally
- {
+
if (Directory.Exists(outputPath))
{
File.Create(Path.Join(outputPath, id));
}
-
- semaphore.Release();
}
}
+ finally
+ {
+ semaphore.Release();
+ }
}
private async Task ExtractAllAttachmentsInternal(