diff --git a/src/Sonarr.Http/Ping/PingController.cs b/src/Sonarr.Http/Ping/PingController.cs index 3e0c3594e..c1b9c02fc 100644 --- a/src/Sonarr.Http/Ping/PingController.cs +++ b/src/Sonarr.Http/Ping/PingController.cs @@ -1,6 +1,9 @@ using System; +using System.Collections.Generic; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; +using NzbDrone.Common.Cache; using NzbDrone.Core.Configuration; using NzbDrone.Http.Ping; @@ -9,19 +12,22 @@ namespace NzbDrone.Http public class PingController : Controller { private readonly IConfigRepository _configRepository; + private readonly ICached> _cache; - public PingController(IConfigRepository configRepository) + public PingController(IConfigRepository configRepository, ICacheManager cacheManager) { _configRepository = configRepository; + _cache = cacheManager.GetCache>(GetType()); } + [AllowAnonymous] [HttpGet("/ping")] [Produces("application/json")] public ActionResult GetStatus() { try { - _configRepository.All(); + _cache.Get("ping", _configRepository.All, TimeSpan.FromSeconds(5)); } catch (Exception) {