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

pull/94/head
Qstick 7 years ago
parent 3383cc1744
commit 54bd3c0b49

@ -53,7 +53,7 @@ namespace Lidarr.Api.V3.Indexers
private Response DownloadRelease(ReleaseResource release)
{
var remoteAlbum = _remoteAlbumCache.Find(release.Guid);
var remoteAlbum = _remoteAlbumCache.Find(GetCacheKey(release));
if (remoteAlbum == null)
{
@ -68,7 +68,7 @@ namespace Lidarr.Api.V3.Indexers
}
catch (ReleaseDownloadException ex)
{
_logger.ErrorException(ex.Message, ex);
_logger.Error(ex, ex.Message);
throw new NzbDroneClientException(HttpStatusCode.Conflict, "Getting release from indexer failed");
}
@ -96,7 +96,7 @@ namespace Lidarr.Api.V3.Indexers
}
catch (Exception ex)
{
_logger.ErrorException("Album search failed: " + ex.Message, ex);
_logger.Error(ex, "Album search failed: " + ex.Message);
}
return new List<ReleaseResource>();
@ -113,8 +113,14 @@ namespace Lidarr.Api.V3.Indexers
protected override ReleaseResource MapDecision(DownloadDecision decision, int initialWeight)
{
_remoteAlbumCache.Set(decision.RemoteAlbum.Release.Guid, decision.RemoteAlbum, TimeSpan.FromMinutes(30));
return base.MapDecision(decision, initialWeight);
var resource = base.MapDecision(decision, initialWeight);
_remoteAlbumCache.Set(GetCacheKey(resource), decision.RemoteAlbum, TimeSpan.FromMinutes(30));
return resource;
}
private string GetCacheKey(ReleaseResource resource)
{
return string.Concat(resource.IndexerId, "_", resource.Guid);
}
}
}

@ -1,4 +1,4 @@
using FluentAssertions;
using FluentAssertions;
using Moq;
using NUnit.Framework;
using NzbDrone.Common.Http;
@ -253,12 +253,9 @@ namespace NzbDrone.Core.Test.IndexerTests.TorrentRssIndexerTests
});
}
[TestCase("BitMeTv/BitMeTv.xml")]
[TestCase("Fanzub/fanzub.xml")]
[TestCase("IPTorrents/IPTorrents.xml")]
[TestCase("Newznab/newznab_nzb_su.xml")]
[TestCase("Nyaa/Nyaa.xml")]
[TestCase("Omgwtfnzbs/Omgwtfnzbs.xml")]
[TestCase("Torznab/torznab_hdaccess_net.xml")]
[TestCase("Torznab/torznab_tpb.xml")]
public void should_detect_recent_feed(string rssXmlFile)

Loading…
Cancel
Save