Fixed: Disable HealthChecks when in debug runtime

pull/1485/head
Bogdan 2 years ago
parent dbeb725cda
commit a8e2b1520a

@ -1,6 +1,7 @@
using System;
using NLog;
using NzbDrone.Common.Cloud;
using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Common.Http;
using NzbDrone.Common.Serializer;
using NzbDrone.Core.Localization;
@ -23,9 +24,14 @@ namespace NzbDrone.Core.HealthCheck.Checks
public override HealthCheck Check()
{
if (BuildInfo.IsDebug)
{
return new HealthCheck(GetType());
}
var request = _cloudRequestBuilder.Create()
.Resource("/time")
.Build();
.Resource("/time")
.Build();
var response = _client.Execute(request);
var result = Json.Deserialize<ServiceTimeResponse>(response.Content);

@ -42,19 +42,25 @@ namespace NzbDrone.Core.HealthCheck
public List<HealthCheck> GetServerChecks()
{
return _cache.Get("ServerChecks", () => RetrieveServerChecks(), TimeSpan.FromHours(2));
return _cache.Get("ServerChecks", RetrieveServerChecks, TimeSpan.FromHours(2));
}
private List<HealthCheck> RetrieveServerChecks()
{
if (BuildInfo.IsDebug)
{
return new List<HealthCheck>();
}
var request = _cloudRequestBuilder.Create()
.Resource("/notification")
.AddQueryParam("version", BuildInfo.Version)
.AddQueryParam("os", OsInfo.Os.ToString().ToLowerInvariant())
.AddQueryParam("arch", RuntimeInformation.OSArchitecture)
.AddQueryParam("runtime", "netcore")
.AddQueryParam("branch", _configFileProvider.Branch)
.Build();
.Resource("/notification")
.AddQueryParam("version", BuildInfo.Version)
.AddQueryParam("os", OsInfo.Os.ToString().ToLowerInvariant())
.AddQueryParam("arch", RuntimeInformation.OSArchitecture)
.AddQueryParam("runtime", "netcore")
.AddQueryParam("branch", _configFileProvider.Branch)
.Build();
try
{
_logger.Trace("Getting server side health notifications");
@ -65,8 +71,9 @@ namespace NzbDrone.Core.HealthCheck
catch (Exception ex)
{
_logger.Error(ex, "Failed to retrieve server notifications");
return new List<HealthCheck>();
}
return new List<HealthCheck>();
}
}

Loading…
Cancel
Save