New: Health check for indexers with invalid download client

pull/5864/head
Bogdan 1 year ago committed by GitHub
parent 551ea18caf
commit 377fce6fe1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,45 @@
using System.Linq;
using NzbDrone.Core.Download;
using NzbDrone.Core.Indexers;
using NzbDrone.Core.Localization;
using NzbDrone.Core.ThingiProvider.Events;
namespace NzbDrone.Core.HealthCheck.Checks
{
[CheckOn(typeof(ProviderUpdatedEvent<IIndexer>))]
[CheckOn(typeof(ProviderDeletedEvent<IIndexer>))]
[CheckOn(typeof(ProviderUpdatedEvent<IDownloadClient>))]
[CheckOn(typeof(ProviderDeletedEvent<IDownloadClient>))]
public class IndexerDownloadClientCheck : HealthCheckBase
{
private readonly IIndexerFactory _indexerFactory;
private readonly IDownloadClientFactory _downloadClientFactory;
public IndexerDownloadClientCheck(IIndexerFactory indexerFactory,
IDownloadClientFactory downloadClientFactory,
ILocalizationService localizationService)
: base(localizationService)
{
_indexerFactory = indexerFactory;
_downloadClientFactory = downloadClientFactory;
}
public override HealthCheck Check()
{
var downloadClientsIds = _downloadClientFactory.All().Where(v => v.Enable).Select(v => v.Id).ToList();
var invalidIndexers = _indexerFactory.All()
.Where(v => v.Enable && v.DownloadClientId > 0 && !downloadClientsIds.Contains(v.DownloadClientId))
.ToList();
if (invalidIndexers.Any())
{
return new HealthCheck(GetType(),
HealthCheckResult.Warning,
string.Format(_localizationService.GetLocalizedString("IndexerDownloadClientHealthCheckMessage"), string.Join(", ", invalidIndexers.Select(v => v.Name).ToArray())),
"#invalid-indexer-download-client-setting");
}
return new HealthCheck(GetType());
}
}
}

@ -170,6 +170,7 @@
"Imported": "Imported",
"IncludeUnmonitored": "Include Unmonitored",
"Indexer": "Indexer",
"IndexerDownloadClientHealthCheckMessage": "Indexers with invalid download clients: {0}.",
"IndexerJackettAllHealthCheckMessage": "Indexers using the unsupported Jackett 'all' endpoint: {0}",
"IndexerLongTermStatusAllUnavailableHealthCheckMessage": "All indexers are unavailable due to failures for more than 6 hours",
"IndexerLongTermStatusUnavailableHealthCheckMessage": "Indexers unavailable due to failures for more than 6 hours: {0}",

Loading…
Cancel
Save