aboutsummaryrefslogtreecommitdiff
path: root/src/Jellyfin.LiveTv/Channels/ChannelManager.cs
diff options
context:
space:
mode:
authorMark Cilia Vincenti <markciliavincenti@gmail.com>2024-01-14 12:11:16 +0100
committerMark Cilia Vincenti <markciliavincenti@gmail.com>2024-01-14 12:11:16 +0100
commite47144e7c777751b03caf7cbb64cf93f92725725 (patch)
treee5abb0ddc4b8655ca983747a4b3e1c13e4d30627 /src/Jellyfin.LiveTv/Channels/ChannelManager.cs
parent6a257e1b40bb66274fb5257297ac1709c892ac50 (diff)
Updated contributors, upgraded to AsyncKeyedLocker 6.3.0 which now supports non-keyed locking using a similar interface and changed SemaphoreSlim-based locks to using AsyncNonKeyedLocker.
Diffstat (limited to 'src/Jellyfin.LiveTv/Channels/ChannelManager.cs')
-rw-r--r--src/Jellyfin.LiveTv/Channels/ChannelManager.cs11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/Jellyfin.LiveTv/Channels/ChannelManager.cs b/src/Jellyfin.LiveTv/Channels/ChannelManager.cs
index f5ce75ff4d..bf735ddd00 100644
--- a/src/Jellyfin.LiveTv/Channels/ChannelManager.cs
+++ b/src/Jellyfin.LiveTv/Channels/ChannelManager.cs
@@ -8,6 +8,7 @@ using System.Linq;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
+using AsyncKeyedLock;
using Jellyfin.Data.Entities;
using Jellyfin.Data.Enums;
using Jellyfin.Extensions;
@@ -50,7 +51,7 @@ namespace Jellyfin.LiveTv.Channels
private readonly IFileSystem _fileSystem;
private readonly IProviderManager _providerManager;
private readonly IMemoryCache _memoryCache;
- private readonly SemaphoreSlim _resourcePool = new SemaphoreSlim(1, 1);
+ private readonly AsyncNonKeyedLocker _resourcePool = new(1);
private readonly JsonSerializerOptions _jsonOptions = JsonDefaults.Options;
private bool _disposed = false;
@@ -832,9 +833,7 @@ namespace Jellyfin.LiveTv.Channels
{
}
- await _resourcePool.WaitAsync(cancellationToken).ConfigureAwait(false);
-
- try
+ using (await _resourcePool.LockAsync(cancellationToken).ConfigureAwait(false))
{
try
{
@@ -881,10 +880,6 @@ namespace Jellyfin.LiveTv.Channels
return result;
}
- finally
- {
- _resourcePool.Release();
- }
}
private async Task CacheResponse(ChannelItemResult result, string path)