mirror of https://github.com/lidarr/Lidarr
Cache fingerprints and relax health check (#658)
This commit is contained in:
parent
3292fba66c
commit
fe3761fc2e
|
@ -32,7 +32,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
|||
}
|
||||
|
||||
var fpcalcVersion = _fingerprintingService.FpcalcVersion();
|
||||
if (fpcalcVersion == null || fpcalcVersion < new Version("1.4.3"))
|
||||
if (fpcalcVersion == null || fpcalcVersion < new Version("1.2.0"))
|
||||
{
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, $"You have an old version of fpcalc. Please upgrade to 1.4.3.", "#fpcalc-upgrade");
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ using NzbDrone.Common.EnvironmentInfo;
|
|||
using System.Threading;
|
||||
using System.Text.RegularExpressions;
|
||||
using Newtonsoft.Json;
|
||||
using NzbDrone.Common.Cache;
|
||||
|
||||
namespace NzbDrone.Core.Parser
|
||||
{
|
||||
|
@ -39,16 +40,19 @@ namespace NzbDrone.Core.Parser
|
|||
private readonly Logger _logger;
|
||||
private readonly IHttpClient _httpClient;
|
||||
private readonly IHttpRequestBuilderFactory _customerRequestBuilder;
|
||||
private readonly ICached<AcoustId> _cache;
|
||||
|
||||
private readonly string _fpcalcPath;
|
||||
private readonly Version _fpcalcVersion;
|
||||
private readonly string _fpcalcArgs;
|
||||
|
||||
public FingerprintingService(Logger logger,
|
||||
IHttpClient httpClient)
|
||||
IHttpClient httpClient,
|
||||
ICacheManager cacheManager)
|
||||
{
|
||||
_logger = logger;
|
||||
_httpClient = httpClient;
|
||||
_cache = cacheManager.GetCache<AcoustId>(GetType());
|
||||
|
||||
_customerRequestBuilder = new HttpRequestBuilder(_acoustIdUrl).CreateFactory();
|
||||
|
||||
|
@ -211,6 +215,11 @@ namespace NzbDrone.Core.Parser
|
|||
}
|
||||
|
||||
public AcoustId GetFingerprint(string file)
|
||||
{
|
||||
return _cache.Get(file, () => GetFingerprintUncached(file), TimeSpan.FromMinutes(30));
|
||||
}
|
||||
|
||||
private AcoustId GetFingerprintUncached(string file)
|
||||
{
|
||||
if (IsSetup() && File.Exists(file))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue