mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-19 21:44:30 -04:00
Fixed: Provider Status housekeeping
This commit is contained in:
@@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.ThingiProvider.Events;
|
||||
|
||||
namespace NzbDrone.Core.ThingiProvider.Status
|
||||
@@ -21,17 +20,6 @@ namespace NzbDrone.Core.ThingiProvider.Status
|
||||
where TProvider : IProvider
|
||||
where TModel : ProviderStatusBase, new()
|
||||
{
|
||||
private static readonly int[] EscalationBackOffPeriods = {
|
||||
0,
|
||||
5 * 60,
|
||||
15 * 60,
|
||||
30 * 60,
|
||||
60 * 60,
|
||||
3 * 60 * 60,
|
||||
6 * 60 * 60,
|
||||
12 * 60 * 60,
|
||||
24 * 60 * 60
|
||||
};
|
||||
|
||||
protected readonly object _syncRoot = new object();
|
||||
|
||||
@@ -39,7 +27,7 @@ namespace NzbDrone.Core.ThingiProvider.Status
|
||||
protected readonly IEventAggregator _eventAggregator;
|
||||
protected readonly Logger _logger;
|
||||
|
||||
protected int MaximumEscalationLevel { get; set; } = EscalationBackOffPeriods.Length - 1;
|
||||
protected int MaximumEscalationLevel { get; set; } = EscalationBackOff.Periods.Length - 1;
|
||||
protected TimeSpan MinimumTimeSinceInitialFailure { get; set; } = TimeSpan.Zero;
|
||||
|
||||
public ProviderStatusServiceBase(IProviderStatusRepository<TModel> providerStatusRepository, IEventAggregator eventAggregator, Logger logger)
|
||||
@@ -63,7 +51,7 @@ namespace NzbDrone.Core.ThingiProvider.Status
|
||||
{
|
||||
var level = Math.Min(MaximumEscalationLevel, status.EscalationLevel);
|
||||
|
||||
return TimeSpan.FromSeconds(EscalationBackOffPeriods[level]);
|
||||
return TimeSpan.FromSeconds(EscalationBackOff.Periods[level]);
|
||||
}
|
||||
|
||||
public virtual void RecordSuccess(int providerId)
|
||||
|
||||
Reference in New Issue
Block a user