From 8e69415d64b14b1af2e45f347bfa4db35f8d2ba4 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Sun, 3 Nov 2024 18:16:39 +0200 Subject: [PATCH] Check for disabled till value in filtering blocked providers --- src/NzbDrone.Core/Applications/ApplicationFactory.cs | 2 +- src/NzbDrone.Core/Download/DownloadClientFactory.cs | 2 +- src/NzbDrone.Core/Indexers/IndexerFactory.cs | 2 +- src/NzbDrone.Core/Notifications/NotificationFactory.cs | 2 +- src/Prowlarr.Api.V1/Indexers/NewznabController.cs | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/NzbDrone.Core/Applications/ApplicationFactory.cs b/src/NzbDrone.Core/Applications/ApplicationFactory.cs index 492710fee..2ecd2e78b 100644 --- a/src/NzbDrone.Core/Applications/ApplicationFactory.cs +++ b/src/NzbDrone.Core/Applications/ApplicationFactory.cs @@ -53,7 +53,7 @@ namespace NzbDrone.Core.Applications foreach (var application in applications) { - if (blockedApplications.TryGetValue(application.Definition.Id, out var blockedApplicationStatus)) + if (blockedApplications.TryGetValue(application.Definition.Id, out var blockedApplicationStatus) && blockedApplicationStatus.DisabledTill.HasValue) { _logger.Debug("Temporarily ignoring application {0} till {1} due to recent failures.", application.Definition.Name, blockedApplicationStatus.DisabledTill.Value.ToLocalTime()); continue; diff --git a/src/NzbDrone.Core/Download/DownloadClientFactory.cs b/src/NzbDrone.Core/Download/DownloadClientFactory.cs index e7eacbbe3..19aedf751 100644 --- a/src/NzbDrone.Core/Download/DownloadClientFactory.cs +++ b/src/NzbDrone.Core/Download/DownloadClientFactory.cs @@ -61,7 +61,7 @@ namespace NzbDrone.Core.Download foreach (var client in clients) { - if (blockedClients.TryGetValue(client.Definition.Id, out var downloadClientStatus)) + if (blockedClients.TryGetValue(client.Definition.Id, out var downloadClientStatus) && downloadClientStatus.DisabledTill.HasValue) { _logger.Debug("Temporarily ignoring download client {0} till {1} due to recent failures.", client.Definition.Name, downloadClientStatus.DisabledTill.Value.ToLocalTime()); continue; diff --git a/src/NzbDrone.Core/Indexers/IndexerFactory.cs b/src/NzbDrone.Core/Indexers/IndexerFactory.cs index 71e7aabdc..46a7e8c3e 100644 --- a/src/NzbDrone.Core/Indexers/IndexerFactory.cs +++ b/src/NzbDrone.Core/Indexers/IndexerFactory.cs @@ -242,7 +242,7 @@ namespace NzbDrone.Core.Indexers foreach (var indexer in indexers) { - if (blockedIndexers.TryGetValue(indexer.Definition.Id, out var blockedIndexerStatus)) + if (blockedIndexers.TryGetValue(indexer.Definition.Id, out var blockedIndexerStatus) && blockedIndexerStatus.DisabledTill.HasValue) { _logger.Debug("Temporarily ignoring indexer {0} till {1} due to recent failures.", indexer.Definition.Name, blockedIndexerStatus.DisabledTill.Value.ToLocalTime()); continue; diff --git a/src/NzbDrone.Core/Notifications/NotificationFactory.cs b/src/NzbDrone.Core/Notifications/NotificationFactory.cs index f9d79940e..824aae0b5 100644 --- a/src/NzbDrone.Core/Notifications/NotificationFactory.cs +++ b/src/NzbDrone.Core/Notifications/NotificationFactory.cs @@ -79,7 +79,7 @@ namespace NzbDrone.Core.Notifications foreach (var notification in notifications) { - if (blockedNotifications.TryGetValue(notification.Definition.Id, out var notificationStatus)) + if (blockedNotifications.TryGetValue(notification.Definition.Id, out var notificationStatus) && notificationStatus.DisabledTill.HasValue) { _logger.Debug("Temporarily ignoring notification {0} till {1} due to recent failures.", notification.Definition.Name, notificationStatus.DisabledTill.Value.ToLocalTime()); continue; diff --git a/src/Prowlarr.Api.V1/Indexers/NewznabController.cs b/src/Prowlarr.Api.V1/Indexers/NewznabController.cs index 07a4f25fb..ae07a7ba7 100644 --- a/src/Prowlarr.Api.V1/Indexers/NewznabController.cs +++ b/src/Prowlarr.Api.V1/Indexers/NewznabController.cs @@ -341,7 +341,7 @@ namespace NzbDrone.Api.V1.Indexers { var blockedIndexers = _indexerStatusService.GetBlockedProviders().ToDictionary(v => v.ProviderId, v => v); - return blockedIndexers.TryGetValue(indexer.Definition.Id, out var blockedIndexerStatus) ? blockedIndexerStatus : null; + return blockedIndexers.GetValueOrDefault(indexer.Definition.Id); } private void AddRetryAfterHeader(int retryAfterSeconds)