From c00c207517673d7667e88c2f93b344b72afdbde4 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Sun, 1 Nov 2015 21:54:49 -0800 Subject: [PATCH] Prevent regrab for all grabs Fixed: Prevent incorrectly grabbing a similar or identical release for 12 hours --- .../HistorySpecificationFixture.cs | 12 ++++++------ .../Specifications/RssSync/HistorySpecification.cs | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/NzbDrone.Core.Test/DecisionEngineTests/HistorySpecificationFixture.cs b/src/NzbDrone.Core.Test/DecisionEngineTests/HistorySpecificationFixture.cs index babdad589..25a10b498 100644 --- a/src/NzbDrone.Core.Test/DecisionEngineTests/HistorySpecificationFixture.cs +++ b/src/NzbDrone.Core.Test/DecisionEngineTests/HistorySpecificationFixture.cs @@ -103,12 +103,12 @@ namespace NzbDrone.Core.Test.DecisionEngineTests _upgradeHistory.IsSatisfiedBy(_parseResultMulti, null).Accepted.Should().BeTrue(); } - [Test] - public void should_return_true_if_latest_history_has_a_download_id_and_cdh_is_enabled() - { - GivenMostRecentForEpisode(FIRST_EPISODE_ID, "test", _upgradableQuality, DateTime.UtcNow, HistoryEventType.Grabbed); - _upgradeHistory.IsSatisfiedBy(_parseResultMulti, null).Accepted.Should().BeTrue(); - } +// [Test] +// public void should_return_true_if_latest_history_has_a_download_id_and_cdh_is_enabled() +// { +// GivenMostRecentForEpisode(FIRST_EPISODE_ID, "test", _notupgradableQuality, DateTime.UtcNow, HistoryEventType.Grabbed); +// _upgradeHistory.IsSatisfiedBy(_parseResultMulti, null).Accepted.Should().BeTrue(); +// } [Test] public void should_return_true_if_latest_history_item_is_older_than_twelve_hours() diff --git a/src/NzbDrone.Core/DecisionEngine/Specifications/RssSync/HistorySpecification.cs b/src/NzbDrone.Core/DecisionEngine/Specifications/RssSync/HistorySpecification.cs index 28e971d8b..159678d88 100644 --- a/src/NzbDrone.Core/DecisionEngine/Specifications/RssSync/HistorySpecification.cs +++ b/src/NzbDrone.Core/DecisionEngine/Specifications/RssSync/HistorySpecification.cs @@ -46,18 +46,18 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync if (mostRecent != null && mostRecent.EventType == HistoryEventType.Grabbed) { - var recentBlackhole = mostRecent.DownloadId.IsNullOrWhiteSpace() && mostRecent.Date.After(DateTime.UtcNow.AddHours(-12)); + var recent = mostRecent.Date.After(DateTime.UtcNow.AddHours(-12)); var cutoffUnmet = _qualityUpgradableSpecification.CutoffNotMet(subject.Series.Profile, mostRecent.Quality, subject.ParsedEpisodeInfo.Quality); var upgradeable = _qualityUpgradableSpecification.IsUpgradable(subject.Series.Profile, mostRecent.Quality, subject.ParsedEpisodeInfo.Quality); - if (!recentBlackhole && cdhEnabled) + if (!recent && cdhEnabled) { continue; } if (!cutoffUnmet) { - if (recentBlackhole) + if (recent) { return Decision.Reject("Recent grab event in history already meets cutoff: {0}", mostRecent.Quality); } @@ -67,7 +67,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync if (!upgradeable) { - if (recentBlackhole) + if (recent) { return Decision.Reject("Recent grab event in history is of equal or higher quality: {0}", mostRecent.Quality); }