From 8eaab46488f00a74197c517c6ef773626aec5173 Mon Sep 17 00:00:00 2001 From: Taloth Saldono Date: Sun, 21 May 2017 22:01:03 +0200 Subject: [PATCH] Fixed up some errors and do the guid cache fix on the module instead of backend coz that would cause other issues. --- src/NzbDrone.Api/Indexers/ReleaseModule.cs | 12 +++++++++--- .../TorrentRssSettingsDetectorFixture.cs | 2 -- src/NzbDrone.Core/Indexers/IndexerBase.cs | 1 - 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/NzbDrone.Api/Indexers/ReleaseModule.cs b/src/NzbDrone.Api/Indexers/ReleaseModule.cs index 6a31ec0b9..e59f0d43f 100644 --- a/src/NzbDrone.Api/Indexers/ReleaseModule.cs +++ b/src/NzbDrone.Api/Indexers/ReleaseModule.cs @@ -53,7 +53,7 @@ public ReleaseModule(IFetchAndParseRss rssFetcherAndParser, private Response DownloadRelease(ReleaseResource release) { - var remoteEpisode = _remoteEpisodeCache.Find(release.Guid); + var remoteEpisode = _remoteEpisodeCache.Find(GetCacheKey(release)); if (remoteEpisode == null) { @@ -113,8 +113,14 @@ private List GetRss() protected override ReleaseResource MapDecision(DownloadDecision decision, int initialWeight) { - _remoteEpisodeCache.Set(decision.RemoteEpisode.Release.Guid, decision.RemoteEpisode, TimeSpan.FromMinutes(30)); - return base.MapDecision(decision, initialWeight); + var resource = base.MapDecision(decision, initialWeight); + _remoteEpisodeCache.Set(GetCacheKey(resource), decision.RemoteEpisode, TimeSpan.FromMinutes(30)); + return resource; + } + + private string GetCacheKey(ReleaseResource resource) + { + return string.Concat(resource.IndexerId, "_", resource.Guid); } } } \ No newline at end of file diff --git a/src/NzbDrone.Core.Test/IndexerTests/TorrentRssIndexerTests/TorrentRssSettingsDetectorFixture.cs b/src/NzbDrone.Core.Test/IndexerTests/TorrentRssIndexerTests/TorrentRssSettingsDetectorFixture.cs index d316cea85..9a3aac3ef 100644 --- a/src/NzbDrone.Core.Test/IndexerTests/TorrentRssIndexerTests/TorrentRssSettingsDetectorFixture.cs +++ b/src/NzbDrone.Core.Test/IndexerTests/TorrentRssIndexerTests/TorrentRssSettingsDetectorFixture.cs @@ -254,10 +254,8 @@ public void should_detect_rss_settings_for_AnimeTosho_without_size() } [TestCase("BitMeTv/BitMeTv.xml")] - [TestCase("Fanzub/fanzub.xml")] [TestCase("IPTorrents/IPTorrents.xml")] [TestCase("Nyaa/Nyaa.xml")] - [TestCase("Omgwtfnzbs/Omgwtfnzbs.xml")] [TestCase("Torznab/torznab_hdaccess_net.xml")] [TestCase("Torznab/torznab_tpb.xml")] [TestCase("Torznab/torznab_animetosho.xml")] diff --git a/src/NzbDrone.Core/Indexers/IndexerBase.cs b/src/NzbDrone.Core/Indexers/IndexerBase.cs index 29d782f88..8d8419095 100644 --- a/src/NzbDrone.Core/Indexers/IndexerBase.cs +++ b/src/NzbDrone.Core/Indexers/IndexerBase.cs @@ -74,7 +74,6 @@ protected virtual IList CleanupReleases(IEnumerable re result.ForEach(c => { - c.Guid = string.Concat(Definition.Id, "_", c.Guid); c.IndexerId = Definition.Id; c.Indexer = Definition.Name; c.DownloadProtocol = Protocol;