diff --git a/code/Infrastructure/Infrastructure.csproj b/code/Infrastructure/Infrastructure.csproj index ad0c2da..c080df3 100644 --- a/code/Infrastructure/Infrastructure.csproj +++ b/code/Infrastructure/Infrastructure.csproj @@ -13,7 +13,7 @@ - + diff --git a/code/Infrastructure/Verticals/DownloadClient/Transmission/TransmissionService.cs b/code/Infrastructure/Verticals/DownloadClient/Transmission/TransmissionService.cs index 0503ca8..05d9114 100644 --- a/code/Infrastructure/Verticals/DownloadClient/Transmission/TransmissionService.cs +++ b/code/Infrastructure/Verticals/DownloadClient/Transmission/TransmissionService.cs @@ -26,7 +26,6 @@ public class TransmissionService : DownloadService, ITransmissionService { private readonly TransmissionConfig _config; private readonly Client _client; - private TorrentInfo[]? _torrentsCache; private static readonly string[] Fields = [ @@ -366,30 +365,8 @@ public class TransmissionService : DownloadService, ITransmissionService return (await StrikeAndCheckLimit(torrent.HashString!, torrent.Name!, StrikeType.Stalled), DeleteReason.Stalled); } - private async Task GetTorrentAsync(string hash) - { - TorrentInfo? torrent = _torrentsCache? - .FirstOrDefault(x => x.HashString.Equals(hash, StringComparison.InvariantCultureIgnoreCase)); - - if (_torrentsCache is null || torrent is null) - { - // refresh cache - _torrentsCache = (await _client.TorrentGetAsync(Fields)) - ?.Torrents; - } - - if (_torrentsCache?.Length is null or 0) - { - _logger.LogDebug("could not list torrents | {url}", _config.Url); - } - - torrent = _torrentsCache?.FirstOrDefault(x => x.HashString.Equals(hash, StringComparison.InvariantCultureIgnoreCase)); - - if (torrent is null) - { - _logger.LogDebug("could not find torrent | {hash} | {url}", hash, _config.Url); - } - - return torrent; - } + private async Task GetTorrentAsync(string hash) => + (await _client.TorrentGetAsync(Fields, hash)) + ?.Torrents + ?.FirstOrDefault(); } \ No newline at end of file