Fixed: Check VIP expiration only for enabled indexers

Check on ProviderBulkUpdatedEvent as well

Fixes #2082
pull/2083/head
Bogdan 2 months ago
parent 41b043e551
commit 5aefb46790

@ -11,6 +11,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
[CheckOn(typeof(ProviderAddedEvent<IIndexer>))]
[CheckOn(typeof(ProviderUpdatedEvent<IIndexer>))]
[CheckOn(typeof(ProviderDeletedEvent<IIndexer>))]
[CheckOn(typeof(ProviderBulkUpdatedEvent<IIndexer>))]
[CheckOn(typeof(ProviderBulkDeletedEvent<IIndexer>))]
public class IndexerVIPCheck : HealthCheckBase
{
@ -24,7 +25,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
public override HealthCheck Check()
{
var indexers = _indexerFactory.AllProviders(false);
var indexers = _indexerFactory.Enabled(false);
var expiringProviders = new List<IIndexer>();
foreach (var provider in indexers)
@ -39,12 +40,8 @@ namespace NzbDrone.Core.HealthCheck.Checks
var expiration = (string)vipProp.GetValue(provider.Definition.Settings);
if (expiration.IsNullOrWhiteSpace())
{
continue;
}
if (DateTime.Parse(expiration).Between(DateTime.Now, DateTime.Now.AddDays(7)))
if (expiration.IsNotNullOrWhiteSpace() &&
DateTime.Parse(expiration).Between(DateTime.Now, DateTime.Now.AddDays(7)))
{
expiringProviders.Add(provider);
}
@ -53,10 +50,12 @@ namespace NzbDrone.Core.HealthCheck.Checks
if (!expiringProviders.Empty())
{
return new HealthCheck(GetType(),
HealthCheckResult.Warning,
string.Format(_localizationService.GetLocalizedString("IndexerVipCheckExpiringClientMessage"),
string.Join(", ", expiringProviders.Select(v => v.Definition.Name))),
"#indexer-vip-expiring");
HealthCheckResult.Warning,
_localizationService.GetLocalizedString("IndexerVipExpiringHealthCheckMessage", new Dictionary<string, object>
{
{ "indexerNames", string.Join(", ", expiringProviders.Select(v => v.Definition.Name).ToArray()) }
}),
"#indexer-vip-expiring");
}
return new HealthCheck(GetType());

@ -11,6 +11,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
[CheckOn(typeof(ProviderAddedEvent<IIndexer>))]
[CheckOn(typeof(ProviderUpdatedEvent<IIndexer>))]
[CheckOn(typeof(ProviderDeletedEvent<IIndexer>))]
[CheckOn(typeof(ProviderBulkUpdatedEvent<IIndexer>))]
[CheckOn(typeof(ProviderBulkDeletedEvent<IIndexer>))]
public class IndexerVIPExpiredCheck : HealthCheckBase
{
@ -24,7 +25,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
public override HealthCheck Check()
{
var indexers = _indexerFactory.AllProviders(false);
var indexers = _indexerFactory.Enabled(false);
var expiredProviders = new List<IIndexer>();
foreach (var provider in indexers)
@ -39,12 +40,8 @@ namespace NzbDrone.Core.HealthCheck.Checks
var expiration = (string)vipProp.GetValue(provider.Definition.Settings);
if (expiration.IsNullOrWhiteSpace())
{
continue;
}
if (DateTime.Parse(expiration).Before(DateTime.Now))
if (expiration.IsNotNullOrWhiteSpace() &&
DateTime.Parse(expiration).Before(DateTime.Now))
{
expiredProviders.Add(provider);
}
@ -53,10 +50,12 @@ namespace NzbDrone.Core.HealthCheck.Checks
if (!expiredProviders.Empty())
{
return new HealthCheck(GetType(),
HealthCheckResult.Error,
string.Format(_localizationService.GetLocalizedString("IndexerVipCheckExpiredClientMessage"),
string.Join(", ", expiredProviders.Select(v => v.Definition.Name))),
"#indexer-vip-expired");
HealthCheckResult.Error,
_localizationService.GetLocalizedString("IndexerVipExpiredHealthCheckMessage", new Dictionary<string, object>
{
{ "indexerNames", string.Join(", ", expiredProviders.Select(v => v.Definition.Name).ToArray()) }
}),
"#indexer-vip-expired");
}
return new HealthCheck(GetType());

@ -194,8 +194,8 @@
"IndexerStatusCheckAllClientMessage": "Alle Indexer sind aufgrund von Fehlern nicht verfügbar",
"IndexerStatusCheckSingleClientMessage": "Indexer aufgrund von Fehlern nicht verfügbar: {0}",
"IndexerTagsHelpText": "Benutze Tags, um Indexer-Proxies zu spezifizieren, mit welchen Apps der Indexer synchronisiert oder um Indexer zu organisieren.",
"IndexerVipCheckExpiredClientMessage": "Die VIP Indexer Vorteile sind abgelaufen: {0}",
"IndexerVipCheckExpiringClientMessage": "Die Indexer VIP Vorteile verfallen bald: {0}",
"IndexerVipExpiredHealthCheckMessage": "Die VIP Indexer Vorteile sind abgelaufen: {indexerNames}",
"IndexerVipExpiringHealthCheckMessage": "Die Indexer VIP Vorteile verfallen bald: {indexerNames}",
"Indexers": "Indexer",
"Info": "Info",
"InstanceName": "Instanzname",

@ -356,7 +356,7 @@
"Auth": "Auth",
"BookSearch": "Αναζήτηση βιβλίου",
"FullSync": "Πλήρης συγχρονισμός",
"IndexerVipCheckExpiringClientMessage": "Τα οφέλη VIP του ευρετηρίου λήγουν σύντομα: {0}",
"IndexerVipExpiringHealthCheckMessage": "Τα οφέλη VIP του ευρετηρίου λήγουν σύντομα: {indexerNames}",
"NotSupported": "Δεν υποστηρίζεται",
"Parameters": "Παράμετροι",
"Public": "Δημόσιο",
@ -394,7 +394,7 @@
"IndexerQuery": "Ερώτημα ευρετηρίου",
"IndexerSettingsSummary": "Διαμορφώστε διάφορες καθολικές ρυθμίσεις ευρετηρίου, συμπεριλαμβανομένων των διακομιστών μεσολάβησης.",
"IndexerSite": "Ιστότοπος ευρετηρίου",
"IndexerVipCheckExpiredClientMessage": "Τα προνόμια VIP του ευρετηρίου έχουν λήξει: {0}",
"IndexerVipExpiredHealthCheckMessage": "Τα προνόμια VIP του ευρετηρίου έχουν λήξει: {indexerNames}",
"MappedCategories": "Χαρτογραφημένες κατηγορίες",
"MovieSearch": "Αναζήτηση ταινίας",
"MovieSearchTypes": "Τύποι αναζήτησης ταινιών",

@ -415,8 +415,8 @@
"IndexerTagsHelpText": "Use tags to specify Indexer Proxies or which apps the indexer is synced to.",
"IndexerTagsHelpTextWarning": "Tags should be used with caution, they can have unintended effects. An indexer with a tag will only sync to apps with the same tag.",
"IndexerTorrentSyndikatSettingsApiKeyHelpText": "Site API Key",
"IndexerVipCheckExpiredClientMessage": "Indexer VIP benefits have expired: {0}",
"IndexerVipCheckExpiringClientMessage": "Indexer VIP benefits expiring soon: {0}",
"IndexerVipExpiredHealthCheckMessage": "Indexer VIP benefits have expired: {indexerNames}",
"IndexerVipExpiringHealthCheckMessage": "Indexer VIP benefits expiring soon: {indexerNames}",
"Indexers": "Indexers",
"Info": "Info",
"InitialFailure": "Initial Failure",

@ -524,10 +524,10 @@
"IndexerRss": "RSS del Indexador",
"IndexerSettingsSummary": "Configurar varios ajustes globales del Indexador, incluyendo Proxies.",
"IndexerName": "Nombre del Indexador",
"IndexerVipCheckExpiringClientMessage": "Las ventajas VIP de los indexadores expiran pronto: {0}",
"IndexerVipExpiringHealthCheckMessage": "Las ventajas VIP de los indexadores expiran pronto: {indexerNames}",
"IndexerProxies": "Proxies del Indexador",
"IndexerHistoryLoadError": "Error al cargar el historial del Indexador",
"IndexerVipCheckExpiredClientMessage": "Las ventajas VIP del Indexador han caducado: {0}",
"IndexerVipExpiredHealthCheckMessage": "Las ventajas VIP del Indexador han caducado: {indexerNames}",
"IndexerQuery": "Consulta dedl Indexador",
"IndexerSite": "Sitio del Indexador",
"IndexerStatus": "Estado del indexador",

@ -317,7 +317,7 @@
"IndexerObsoleteCheckMessage": "Tietolähteet ovat poistuneet tai ne ovat muuttuneet: {0}. Poista ja/tai lisää ne {appName}iin uudelleen.",
"IndexerProxy": "Tiedonhaun välityspalvelin",
"IndexerSettingsSummary": "Määritä useita globaaleita tietolähdeasetuksia, kuten välityspalvelimia.",
"IndexerVipCheckExpiringClientMessage": "Tietolähteen VIP-edut erääntyvät pian: {0}",
"IndexerVipExpiringHealthCheckMessage": "Tietolähteen VIP-edut erääntyvät pian: {indexerNames}",
"ProwlarrSupportsAnyIndexer": "{appName} tukee Newznab- ja Torznab-yhteensopivien tietolähteiden ohella myös useita muita lähteitä vaihtoehdoilla \"Yleinen Newznab\" (Usenetille) ja 'Yleinen Torznab' (torrenteille).",
"SettingsIndexerLogging": "Tehostettu tietolähteiden valvonta",
"AddIndexerProxy": "Lisää tiedonhaun välityspalvelin",
@ -330,7 +330,7 @@
"IndexerRss": "Tietolähteen RSS",
"SearchIndexers": "Etsi tietolähteistä",
"AddRemoveOnly": "Ainoastaan lisää/poista",
"IndexerVipCheckExpiredClientMessage": "Tietolähteen VIP-edut ovat erääntyneet: {0}",
"IndexerVipExpiredHealthCheckMessage": "Tietolähteen VIP-edut ovat erääntyneet: {indexerNames}",
"MaintenanceRelease": "Huoltojulkaisu: korjauksia ja muita parannuksia. Lue lisää Githubin muutoshistoriasta.",
"Query": "Kysely",
"Redirect": "Uudelleenohjaus",

@ -368,13 +368,13 @@
"AppSettingsSummary": "Applications et paramètres pour configurer comment {appName} interagit avec vos programmes PVR",
"IndexerTagsHelpText": "Utilisez des étiquettes pour spécifier les proxies d'indexation ou les applications avec lesquelles l'indexeur est synchronisé.",
"Notifications": "Notifications",
"IndexerVipCheckExpiredClientMessage": "Les avantages VIP de l'indexeur ont expiré : {0}",
"IndexerVipExpiredHealthCheckMessage": "Les avantages VIP de l'indexeur ont expiré : {indexerNames}",
"IndexerProxy": "Proxy d'indexation",
"IndexerSettingsSummary": "Configuration de divers paramètres globaux de l'indexeur, y compris les proxies.",
"IndexerProxies": "Proxys d'indexation",
"IndexerProxyStatusAllUnavailableHealthCheckMessage": "Tous les proxys sont indisponibles en raison d'échecs",
"IndexerProxyStatusUnavailableHealthCheckMessage": "Proxys indisponibles en raison d'échecs : {indexerProxyNames}",
"IndexerVipCheckExpiringClientMessage": "Les avantages VIP de l'indexeur arrivent bientôt à expiration : {0}",
"IndexerVipExpiringHealthCheckMessage": "Les avantages VIP de l'indexeur arrivent bientôt à expiration : {indexerNames}",
"NoLinks": "Aucun liens",
"Notification": "Notification",
"UnableToAddANewIndexerProxyPleaseTryAgain": "Impossible d'ajouter un nouveau proxy d'indexation, veuillez réessayer.",

@ -374,8 +374,8 @@
"IndexerSettingsSummary": "Konfigurálja a különböző globális indexer beállításokat, beleértve a proxykat is.",
"Notifications": "Értesítések",
"UnableToAddANewIndexerProxyPleaseTryAgain": "Nem lehet új Indexer Proxyt hozzáadni, próbálja újra.",
"IndexerVipCheckExpiredClientMessage": "Az Indexer VIP előnyei lejártak: {0}",
"IndexerVipCheckExpiringClientMessage": "Az Indexer VIP előnyei hamarosan lejárnak: {0}",
"IndexerVipExpiredHealthCheckMessage": "Az Indexer VIP előnyei lejártak: {indexerNames}",
"IndexerVipExpiringHealthCheckMessage": "Az Indexer VIP előnyei hamarosan lejárnak: {indexerNames}",
"IndexerProxy": "Indexelő Proxy",
"NoLinks": "Nincsenek Linkek",
"Notification": "Értesítés",

@ -365,8 +365,8 @@
"Apps": "Le App",
"DevelopmentSettings": "Impostazioni di Sviluppo",
"RedirectHelpText": "Reindirizza le richieste di download per l'Indicizzatore e passa il prelievo direttamente invece di inoltrare la richiesta tramite {appName}",
"IndexerVipCheckExpiredClientMessage": "I benefici VIP dell'Indicizzatore sono scaduti: {0}",
"IndexerVipCheckExpiringClientMessage": "I benefici VIP dell'Indicizzatore scadranno a breve: {0}",
"IndexerVipExpiredHealthCheckMessage": "I benefici VIP dell'Indicizzatore sono scaduti: {indexerNames}",
"IndexerVipExpiringHealthCheckMessage": "I benefici VIP dell'Indicizzatore scadranno a breve: {indexerNames}",
"IndexerProxies": "Proxy degli Indicizzatori",
"Stats": "Statistiche",
"SyncAppIndexers": "Sincronizza tutti gli indicizzatori",

@ -185,8 +185,8 @@
"IndexerStatusCheckAllClientMessage": "Alle indexeerders zijn onbeschikbaar wegens fouten",
"IndexerStatusCheckSingleClientMessage": "Indexeerders onbeschikbaar wegens fouten: {0}",
"IndexerTagsHelpText": "Gebruik tags om standaardclients op te geven, Indexeerder-proxy's op te geven of gewoon om uw indexeerders te ordenen.",
"IndexerVipCheckExpiredClientMessage": "Indexeerder VIP-voordelen zijn verlopen: {0}",
"IndexerVipCheckExpiringClientMessage": "Indexeerder VIP-voordelen verlopen binnenkort: {0}",
"IndexerVipExpiredHealthCheckMessage": "Indexeerder VIP-voordelen zijn verlopen: {indexerNames}",
"IndexerVipExpiringHealthCheckMessage": "Indexeerder VIP-voordelen verlopen binnenkort: {indexerNames}",
"Indexers": "Indexeerders",
"Info": "Info",
"InstanceName": "Naam van de instantie",

@ -216,8 +216,8 @@
"IndexerStatusCheckAllClientMessage": "Todos os indexadores estão indisponíveis devido a falhas",
"IndexerStatusCheckSingleClientMessage": "Indexadores indisponíveis devido a falhas: {0}",
"IndexerTagsHelpText": "Use tags para especificar Proxies do indexador ou com quais aplicativos o indexador está sincronizado.",
"IndexerVipCheckExpiredClientMessage": "Benefícios VIP do Indexador expiraram: {0}",
"IndexerVipCheckExpiringClientMessage": "Os benefícios VIPS do Indexador expirarão em breve: {0}",
"IndexerVipExpiredHealthCheckMessage": "Benefícios VIP do Indexador expiraram: {indexerNames}",
"IndexerVipExpiringHealthCheckMessage": "Os benefícios VIPS do Indexador expirarão em breve: {indexerNames}",
"Indexers": "Indexadores",
"Info": "Informações",
"InitialFailure": "Falha Inicial",

@ -328,7 +328,7 @@
"EnableRssHelpText": "Activați flux RSS pentru indexator",
"IndexerHealthCheckNoIndexers": "Niciun indexator nu este activat, {appName} nu va returna rezultate la căutare.",
"IndexerProxy": "Proxy indexator",
"IndexerVipCheckExpiredClientMessage": "Beneficiile VIP pentru indexator au expirat: {0}",
"IndexerVipExpiredHealthCheckMessage": "Beneficiile VIP pentru indexator au expirat: {indexerNames}",
"IndexerNoDefCheckMessage": "Indexatorii nu au definiție și nu vor funcționa: {0}. Vă rugăm să-i ștergeți și (sau) să-i adăugați din nou în {appName}",
"IndexerRss": "RSS indexator",
"EnabledRedirected": "Activat, Redirecționat",
@ -363,7 +363,7 @@
"FullSync": "Sincronizare completă",
"IndexerObsoleteCheckMessage": "Indexatorii sunt învechiți sau nu au fost actualizați: {0}. Vă rugăm să-i ștergeți și (sau) să-i adăugați din nou în {appName}",
"IndexerProxies": "Proxiuri indexatoare",
"IndexerVipCheckExpiringClientMessage": "Beneficiile VIP pentru indexator expiră în curând: {0}",
"IndexerVipExpiringHealthCheckMessage": "Beneficiile VIP pentru indexator expiră în curând: {indexerNames}",
"ApplicationLongTermStatusCheckAllClientMessage": "Toate aplicațiile sunt indisponibile din cauza unor eșecuri pentru mai mult de 6 ore",
"ApplicationLongTermStatusCheckSingleClientMessage": "Aplicațiile indisponibile din cauza unor eșecuri pentru mai mult de 6 ore: {0}",
"LastDuration": "Ultima durată",

@ -342,8 +342,8 @@
"NoSearchResultsFound": "Inget sökresultat hittat, försök utföra en ny sökning nedan.",
"NetCore": ".NET",
"MaintenanceRelease": "Underhållsutgåva",
"IndexerVipCheckExpiringClientMessage": "Indexer VIP förmåner utgår snart: {0}",
"IndexerVipCheckExpiredClientMessage": "Indexer VIP förmåner har utgått: {0}",
"IndexerVipExpiringHealthCheckMessage": "Indexer VIP förmåner utgår snart: {indexerNames}",
"IndexerVipExpiredHealthCheckMessage": "Indexer VIP förmåner har utgått: {indexerNames}",
"IndexerTagsHelpText": "Använd taggar för att specificera standardklient, specificera Indexer Proxies, eller bara för att organisera dina indexers.",
"IndexerSettingsSummary": "Konfigurera flera globala Indexerinställningar, includerat Proxies.",
"IndexerRss": "Indexer Rss",

@ -215,8 +215,8 @@
"IndexerStatusCheckAllClientMessage": "所有搜刮器都因错误不可用",
"IndexerStatusCheckSingleClientMessage": "搜刮器因错误不可用:{0}",
"IndexerTagsHelpText": "使用标签来指定索引器代理或索引器同步到哪些应用程序。",
"IndexerVipCheckExpiredClientMessage": "索引器VIP特权已过期{0}",
"IndexerVipCheckExpiringClientMessage": "索引器VIP特权即将过期{0}",
"IndexerVipExpiredHealthCheckMessage": "索引器VIP特权已过期{indexerNames}",
"IndexerVipExpiringHealthCheckMessage": "索引器VIP特权即将过期{indexerNames}",
"Indexers": "索引器",
"Info": "信息",
"InitialFailure": "初始化失败",

Loading…
Cancel
Save