1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00

Fixed up some errors and do the guid cache fix on the module instead of backend coz that would cause other issues.

This commit is contained in:
Taloth Saldono 2017-05-21 22:01:03 +02:00
parent 4fbc481780
commit 8eaab46488
3 changed files with 9 additions and 6 deletions

View File

@ -53,7 +53,7 @@ public ReleaseModule(IFetchAndParseRss rssFetcherAndParser,
private Response DownloadRelease(ReleaseResource release) private Response DownloadRelease(ReleaseResource release)
{ {
var remoteEpisode = _remoteEpisodeCache.Find(release.Guid); var remoteEpisode = _remoteEpisodeCache.Find(GetCacheKey(release));
if (remoteEpisode == null) if (remoteEpisode == null)
{ {
@ -113,8 +113,14 @@ private List<ReleaseResource> GetRss()
protected override ReleaseResource MapDecision(DownloadDecision decision, int initialWeight) protected override ReleaseResource MapDecision(DownloadDecision decision, int initialWeight)
{ {
_remoteEpisodeCache.Set(decision.RemoteEpisode.Release.Guid, decision.RemoteEpisode, TimeSpan.FromMinutes(30)); var resource = base.MapDecision(decision, initialWeight);
return 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);
} }
} }
} }

View File

@ -254,10 +254,8 @@ public void should_detect_rss_settings_for_AnimeTosho_without_size()
} }
[TestCase("BitMeTv/BitMeTv.xml")] [TestCase("BitMeTv/BitMeTv.xml")]
[TestCase("Fanzub/fanzub.xml")]
[TestCase("IPTorrents/IPTorrents.xml")] [TestCase("IPTorrents/IPTorrents.xml")]
[TestCase("Nyaa/Nyaa.xml")] [TestCase("Nyaa/Nyaa.xml")]
[TestCase("Omgwtfnzbs/Omgwtfnzbs.xml")]
[TestCase("Torznab/torznab_hdaccess_net.xml")] [TestCase("Torznab/torznab_hdaccess_net.xml")]
[TestCase("Torznab/torznab_tpb.xml")] [TestCase("Torznab/torznab_tpb.xml")]
[TestCase("Torznab/torznab_animetosho.xml")] [TestCase("Torznab/torznab_animetosho.xml")]

View File

@ -74,7 +74,6 @@ protected virtual IList<ReleaseInfo> CleanupReleases(IEnumerable<ReleaseInfo> re
result.ForEach(c => result.ForEach(c =>
{ {
c.Guid = string.Concat(Definition.Id, "_", c.Guid);
c.IndexerId = Definition.Id; c.IndexerId = Definition.Id;
c.Indexer = Definition.Name; c.Indexer = Definition.Name;
c.DownloadProtocol = Protocol; c.DownloadProtocol = Protocol;