1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2025-01-10 23:29:53 +02:00

Add one minute back-off level for all providers

This commit is contained in:
Bogdan 2023-08-12 07:19:27 +03:00 committed by GitHub
parent 901b6d2084
commit d8f314ff0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 4 deletions

View File

@ -91,7 +91,7 @@ public void should_start_backoff_on_first_failure()
var status = Subject.GetBlockedProviders().FirstOrDefault();
status.Should().NotBeNull();
status.DisabledTill.Should().HaveValue();
status.DisabledTill.Value.Should().BeCloseTo(_epoch + TimeSpan.FromMinutes(5), _disabledTillPrecision);
status.DisabledTill.Value.Should().BeCloseTo(_epoch + TimeSpan.FromMinutes(1), _disabledTillPrecision);
}
[Test]
@ -134,7 +134,7 @@ public void should_preserve_escalation_on_intermittent_success()
var status = Subject.GetBlockedProviders().FirstOrDefault();
status.Should().NotBeNull();
status.DisabledTill.Should().HaveValue();
status.DisabledTill.Value.Should().BeCloseTo(_epoch + TimeSpan.FromMinutes(15), _disabledTillPrecision);
status.DisabledTill.Value.Should().BeCloseTo(_epoch + TimeSpan.FromMinutes(5), _disabledTillPrecision);
}
[Test]

View File

@ -1,10 +1,11 @@
namespace NzbDrone.Core.ThingiProvider.Status
namespace NzbDrone.Core.ThingiProvider.Status
{
public static class EscalationBackOff
{
public static readonly int[] Periods =
{
0,
60,
5 * 60,
15 * 60,
30 * 60,

View File

@ -116,7 +116,7 @@ protected virtual void RecordFailure(int providerId, TimeSpan minimumBackOff, bo
if (inStartupGracePeriod && minimumBackOff == TimeSpan.Zero && status.DisabledTill.HasValue)
{
var maximumDisabledTill = now + TimeSpan.FromSeconds(EscalationBackOff.Periods[1]);
var maximumDisabledTill = now + TimeSpan.FromSeconds(EscalationBackOff.Periods[2]);
if (maximumDisabledTill < status.DisabledTill)
{
status.DisabledTill = maximumDisabledTill;