mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-04 10:02:40 +01:00
Fixed: Health check failing and preventing others from running
This commit is contained in:
parent
79043f2c64
commit
be4d70e3a9
@ -1,7 +1,10 @@
|
||||
using System.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.Download.Clients;
|
||||
using NzbDrone.Core.Download.Clients.Nzbget;
|
||||
using NzbDrone.Core.Download.Clients.Sabnzbd;
|
||||
|
||||
@ -22,11 +25,26 @@ public ImportMechanismCheck(IConfigService configService, IProvideDownloadClient
|
||||
public override HealthCheck Check()
|
||||
{
|
||||
var droneFactoryFolder = new OsPath(_configService.DownloadedEpisodesFolder);
|
||||
var downloadClients = _provideDownloadClient.GetDownloadClients().Select(v => new { downloadClient = v, status = v.GetStatus() }).ToList();
|
||||
List<ImportMechanismCheckStatus> downloadClients;
|
||||
|
||||
var downloadClientIsLocalHost = downloadClients.All(v => v.status.IsLocalhost);
|
||||
var downloadClientOutputInDroneFactory = !droneFactoryFolder.IsEmpty
|
||||
&& downloadClients.Any(v => v.status.OutputRootFolders != null && v.status.OutputRootFolders.Any(droneFactoryFolder.Contains));
|
||||
try
|
||||
{
|
||||
downloadClients = _provideDownloadClient.GetDownloadClients().Select(v => new ImportMechanismCheckStatus
|
||||
{
|
||||
DownloadClient = v,
|
||||
Status = v.GetStatus()
|
||||
}).ToList();
|
||||
}
|
||||
catch (DownloadClientException)
|
||||
{
|
||||
// One or more download clients failed, assume the health is okay and verify later
|
||||
return new HealthCheck(GetType());
|
||||
}
|
||||
|
||||
var downloadClientIsLocalHost = downloadClients.All(v => v.Status.IsLocalhost);
|
||||
var downloadClientOutputInDroneFactory = !droneFactoryFolder.IsEmpty &&
|
||||
downloadClients.Any(v => v.Status.OutputRootFolders != null &&
|
||||
v.Status.OutputRootFolders.Any(droneFactoryFolder.Contains));
|
||||
|
||||
if (!_configService.IsDefined("EnableCompletedDownloadHandling"))
|
||||
{
|
||||
@ -36,7 +54,7 @@ public override HealthCheck Check()
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, "Enable Completed Download Handling if possible (Multi-Computer unsupported)", "Migrating-to-Completed-Download-Handling#Unsupported-download-client-on-different-computer");
|
||||
}
|
||||
|
||||
if (downloadClients.All(v => v.downloadClient is Sabnzbd))
|
||||
if (downloadClients.All(v => v.DownloadClient is Sabnzbd))
|
||||
{
|
||||
// With Sabnzbd we can check if the category should be changed.
|
||||
if (downloadClientOutputInDroneFactory)
|
||||
@ -46,7 +64,8 @@ public override HealthCheck Check()
|
||||
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, "Enable Completed Download Handling if possible (Sabnzbd)", "Migrating-to-Completed-Download-Handling#sabnzbd-enable-completed-download-handling");
|
||||
}
|
||||
if (downloadClients.All(v => v.downloadClient is Nzbget))
|
||||
|
||||
if (downloadClients.All(v => v.DownloadClient is Nzbget))
|
||||
{
|
||||
// With Nzbget we can check if the category should be changed.
|
||||
if (downloadClientOutputInDroneFactory)
|
||||
@ -56,6 +75,7 @@ public override HealthCheck Check()
|
||||
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, "Enable Completed Download Handling if possible (Nzbget)", "Migrating-to-Completed-Download-Handling#nzbget-enable-completed-download-handling");
|
||||
}
|
||||
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, "Enable Completed Download Handling if possible", "Migrating-to-Completed-Download-Handling");
|
||||
}
|
||||
|
||||
@ -64,8 +84,13 @@ public override HealthCheck Check()
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, "Enable Completed Download Handling or configure Drone factory");
|
||||
}
|
||||
|
||||
|
||||
return new HealthCheck(GetType());
|
||||
}
|
||||
}
|
||||
|
||||
public class ImportMechanismCheckStatus
|
||||
{
|
||||
public IDownloadClient DownloadClient { get; set; }
|
||||
public DownloadClientStatus Status { get; set; }
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user