Skip to content

Commit

Permalink
Add one minute back-off level for all providers
Browse files Browse the repository at this point in the history
(cherry picked from commit d8f314ff0ef64e8d90b21b7865e46be74db5e570)
  • Loading branch information
mynameisbogdan committed Aug 12, 2023
1 parent 25f6f3e commit c3b8564
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
Expand Up @@ -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]
Expand Down Expand Up @@ -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]
Expand Down
3 changes: 2 additions & 1 deletion src/NzbDrone.Core/ThingiProvider/Status/EscalationBackOff.cs
@@ -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,
Expand Down
Expand Up @@ -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;
Expand Down

0 comments on commit c3b8564

Please sign in to comment.