From 44d8dbaac81706691124ae5f8317289f0a3e5d73 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Sun, 29 Oct 2023 12:14:02 -0700 Subject: [PATCH] Fixed: Blocking unknown indexers from pushed releases Closes #5900 --- .../IndexerTests/IndexerStatusServiceFixture.cs | 11 +++++++++++ .../Status/ProviderStatusServiceBase.cs | 5 +++++ 2 files changed, 16 insertions(+) diff --git a/src/NzbDrone.Core.Test/IndexerTests/IndexerStatusServiceFixture.cs b/src/NzbDrone.Core.Test/IndexerTests/IndexerStatusServiceFixture.cs index 55ed8abfb..f836852e1 100644 --- a/src/NzbDrone.Core.Test/IndexerTests/IndexerStatusServiceFixture.cs +++ b/src/NzbDrone.Core.Test/IndexerTests/IndexerStatusServiceFixture.cs @@ -68,5 +68,16 @@ namespace NzbDrone.Core.Test.IndexerTests VerifyNoUpdate(); } + + [Test] + public void should_not_record_failure_for_unknown_provider() + { + Subject.RecordFailure(0); + + Mocker.GetMock() + .Verify(v => v.FindByProviderId(1), Times.Never); + + VerifyNoUpdate(); + } } } diff --git a/src/NzbDrone.Core/ThingiProvider/Status/ProviderStatusServiceBase.cs b/src/NzbDrone.Core/ThingiProvider/Status/ProviderStatusServiceBase.cs index 15cf84d3b..40c353b24 100644 --- a/src/NzbDrone.Core/ThingiProvider/Status/ProviderStatusServiceBase.cs +++ b/src/NzbDrone.Core/ThingiProvider/Status/ProviderStatusServiceBase.cs @@ -79,6 +79,11 @@ namespace NzbDrone.Core.ThingiProvider.Status protected virtual void RecordFailure(int providerId, TimeSpan minimumBackOff, bool escalate) { + if (providerId <= 0) + { + return; + } + lock (_syncRoot) { var status = GetProviderStatus(providerId);