diff --git a/PlexRequests.Core/Setup.cs b/PlexRequests.Core/Setup.cs index 0e2f453c5..bbf41039e 100644 --- a/PlexRequests.Core/Setup.cs +++ b/PlexRequests.Core/Setup.cs @@ -36,6 +36,7 @@ using PlexRequests.Core.SettingModels; using PlexRequests.Helpers; using PlexRequests.Store; using PlexRequests.Store.Repository; +using System.Threading.Tasks; namespace PlexRequests.Core { @@ -102,14 +103,14 @@ namespace PlexRequests.Core s.SaveSettings(defaultSettings); } - public async void CacheQualityProfiles() + public void CacheQualityProfiles() { var mc = new MemoryCacheProvider(); try { - CacheSonarrQualityProfiles(mc); - CacheCouchPotatoQualityProfiles(mc); + Task.Run(() => { CacheSonarrQualityProfiles(mc); }); + Task.Run(() => { CacheCouchPotatoQualityProfiles(mc); }); // we don't need to cache sickrage profiles, those are static // TODO: cache headphones profiles? } @@ -119,7 +120,7 @@ namespace PlexRequests.Core } } - private async void CacheSonarrQualityProfiles(MemoryCacheProvider cacheProvider) + private void CacheSonarrQualityProfiles(MemoryCacheProvider cacheProvider) { try { @@ -141,7 +142,7 @@ namespace PlexRequests.Core } } - private async void CacheCouchPotatoQualityProfiles(MemoryCacheProvider cacheProvider) + private void CacheCouchPotatoQualityProfiles(MemoryCacheProvider cacheProvider) { try { diff --git a/PlexRequests.UI.Tests/AdminModuleTests.cs b/PlexRequests.UI.Tests/AdminModuleTests.cs index 34b2af4a7..130000db9 100644 --- a/PlexRequests.UI.Tests/AdminModuleTests.cs +++ b/PlexRequests.UI.Tests/AdminModuleTests.cs @@ -44,6 +44,7 @@ using PlexRequests.Store.Models; using PlexRequests.Store.Repository; using PlexRequests.UI.Models; using PlexRequests.UI.Modules; +using PlexRequests.Helpers; namespace PlexRequests.UI.Tests { @@ -67,6 +68,7 @@ namespace PlexRequests.UI.Tests private Mock CpApi { get; set; } private Mock> LogRepo { get; set; } private Mock NotificationService { get; set; } + private Mock Cache { get; set; } private ConfigurableBootstrapper Bootstrapper { get; set; } @@ -96,6 +98,7 @@ namespace PlexRequests.UI.Tests PushoverApi = new Mock(); NotificationService = new Mock(); HeadphonesSettings = new Mock>(); + Cache = new Mock(); Bootstrapper = new ConfigurableBootstrapper(with => { @@ -117,6 +120,7 @@ namespace PlexRequests.UI.Tests with.Dependency(PushoverApi.Object); with.Dependency(NotificationService.Object); with.Dependency(HeadphonesSettings.Object); + with.Dependencies(Cache.Object); with.RootPathProvider(); with.RequestStartup((container, pipelines, context) => { diff --git a/PlexRequests.UI.Tests/PlexRequests.UI.Tests.csproj b/PlexRequests.UI.Tests/PlexRequests.UI.Tests.csproj index e79b01dc4..12950fc2c 100644 --- a/PlexRequests.UI.Tests/PlexRequests.UI.Tests.csproj +++ b/PlexRequests.UI.Tests/PlexRequests.UI.Tests.csproj @@ -113,6 +113,10 @@ {DD7DC444-D3BF-4027-8AB9-EFC71F5EC581} PlexRequests.Core + + {1252336d-42a3-482a-804c-836e60173dfa} + PlexRequests.Helpers + {566EFA49-68F8-4716-9693-A6B3F2624DEA} PlexRequests.Services