From 298077940e4e267a4a7e29425d32ba9745028b22 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Sat, 5 Aug 2023 09:55:36 +0300 Subject: [PATCH] Fixed: Ensure failing providers are marked as failed when testing all (cherry picked from commit f6c05d4456a5667398319e249614e2eed115621e) Closes #8960 --- .../Download/DownloadClientFactory.cs | 11 +++++++++- .../ImportLists/ImportListFactory.cs | 22 +++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Core/Download/DownloadClientFactory.cs b/src/NzbDrone.Core/Download/DownloadClientFactory.cs index ee155cb905..ba5ea27f2e 100644 --- a/src/NzbDrone.Core/Download/DownloadClientFactory.cs +++ b/src/NzbDrone.Core/Download/DownloadClientFactory.cs @@ -74,10 +74,19 @@ public override ValidationResult Test(DownloadClientDefinition definition) { var result = base.Test(definition); - if ((result == null || result.IsValid) && definition.Id != 0) + if (definition.Id == 0) + { + return result; + } + + if (result == null || result.IsValid) { _downloadClientStatusService.RecordSuccess(definition.Id); } + else + { + _downloadClientStatusService.RecordFailure(definition.Id); + } return result; } diff --git a/src/NzbDrone.Core/ImportLists/ImportListFactory.cs b/src/NzbDrone.Core/ImportLists/ImportListFactory.cs index b2511702bb..abd47f38a3 100644 --- a/src/NzbDrone.Core/ImportLists/ImportListFactory.cs +++ b/src/NzbDrone.Core/ImportLists/ImportListFactory.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using FluentValidation.Results; using NLog; using NzbDrone.Core.Messaging.Events; using NzbDrone.Core.ThingiProvider; @@ -77,5 +78,26 @@ private IEnumerable FilterBlockedImportLists(IEnumerable