task.run for startup caching + fix admin module unit test failures

pull/140/head
Drewster727 9 years ago
parent 7593d3a7e9
commit b1ea713c77

@ -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
{

@ -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<ICouchPotatoApi> CpApi { get; set; }
private Mock<IRepository<LogEntity>> LogRepo { get; set; }
private Mock<INotificationService> NotificationService { get; set; }
private Mock<ICacheProvider> Cache { get; set; }
private ConfigurableBootstrapper Bootstrapper { get; set; }
@ -96,6 +98,7 @@ namespace PlexRequests.UI.Tests
PushoverApi = new Mock<IPushoverApi>();
NotificationService = new Mock<INotificationService>();
HeadphonesSettings = new Mock<ISettingsService<HeadphonesSettings>>();
Cache = new Mock<ICacheProvider>();
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<TestRootPathProvider>();
with.RequestStartup((container, pipelines, context) =>
{

@ -113,6 +113,10 @@
<Project>{DD7DC444-D3BF-4027-8AB9-EFC71F5EC581}</Project>
<Name>PlexRequests.Core</Name>
</ProjectReference>
<ProjectReference Include="..\PlexRequests.Helpers\PlexRequests.Helpers.csproj">
<Project>{1252336d-42a3-482a-804c-836e60173dfa}</Project>
<Name>PlexRequests.Helpers</Name>
</ProjectReference>
<ProjectReference Include="..\PlexRequests.Services\PlexRequests.Services.csproj">
<Project>{566EFA49-68F8-4716-9693-A6B3F2624DEA}</Project>
<Name>PlexRequests.Services</Name>

Loading…
Cancel
Save