Don't store status results for invalid providers

(cherry picked from commit de23182d593e2284972103d505e66dd8d812dfdb)
(cherry picked from commit 44d8dbaac81706691124ae5f8317289f0a3e5d73)
pull/1920/head
Mark McDowall 1 year ago committed by Bogdan
parent 95f899131d
commit 6969326092

@ -68,5 +68,16 @@ namespace NzbDrone.Core.Test.IndexerTests
VerifyNoUpdate(); VerifyNoUpdate();
} }
[Test]
public void should_not_record_failure_for_unknown_provider()
{
Subject.RecordFailure(0);
Mocker.GetMock<IIndexerStatusRepository>()
.Verify(v => v.FindByProviderId(1), Times.Never);
VerifyNoUpdate();
}
} }
} }

@ -59,6 +59,11 @@ namespace NzbDrone.Core.ThingiProvider.Status
public virtual void RecordSuccess(int providerId) public virtual void RecordSuccess(int providerId)
{ {
if (providerId <= 0)
{
return;
}
lock (_syncRoot) lock (_syncRoot)
{ {
var status = GetProviderStatus(providerId); var status = GetProviderStatus(providerId);
@ -79,6 +84,11 @@ namespace NzbDrone.Core.ThingiProvider.Status
protected virtual void RecordFailure(int providerId, TimeSpan minimumBackOff, bool escalate) protected virtual void RecordFailure(int providerId, TimeSpan minimumBackOff, bool escalate)
{ {
if (providerId <= 0)
{
return;
}
lock (_syncRoot) lock (_syncRoot)
{ {
var status = GetProviderStatus(providerId); var status = GetProviderStatus(providerId);

Loading…
Cancel
Save