pull/158/head
tidusjar 9 years ago
parent 3261bdbf9b
commit 7679a13254

@ -25,6 +25,8 @@
// ************************************************************************/
#endregion
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Reactive.Linq;
using System.Web.Hosting;
@ -47,8 +49,10 @@ namespace PlexRequests.Services
{
public class AvailabilityUpdateService : ITask, IRegisteredObject, IAvailabilityUpdateService
{
public AvailabilityUpdateService()
{
var memCache = new MemoryCacheProvider();
var dbConfig = new DbConfiguration(new SqliteFactory());
var repo = new SettingsJsonRepository(dbConfig, memCache);
@ -67,7 +71,6 @@ namespace PlexRequests.Services
public void Start(Configuration c)
{
UpdateSubscription?.Dispose();
Task.Factory.StartNew(() => Checker.CheckAndUpdateAll(-1)); // cache the libraries and run the availability checks
UpdateSubscription = Observable.Interval(c.Intervals.Notification).Subscribe(Checker.CheckAndUpdateAll);
}

@ -110,10 +110,7 @@ namespace PlexRequests.UI
SubscribeAllObservers(container);
base.ConfigureRequestContainer(container, context);
TaskManager.TaskFactory = new PlexTaskFactory();
TaskManager.Initialize(new PlexRegistry());
TaskManager.Initialize(new MediaCacheRegistry());
_container = container;
}
protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)

@ -25,6 +25,8 @@
// ************************************************************************/
#endregion
using System;
using System.Collections.Generic;
using Microsoft.Owin.Hosting;
using Mono.Data.Sqlite;
@ -39,6 +41,11 @@ using PlexRequests.Store;
using PlexRequests.Store.Repository;
using System.Diagnostics;
using FluentScheduler;
using PlexRequests.Services;
using PlexRequests.UI.Jobs;
namespace PlexRequests.UI
{
class Program
@ -85,6 +92,9 @@ namespace PlexRequests.UI
s.CacheQualityProfiles();
ConfigureTargets(cn);
SetupSchedulers();
if (port == -1)
port = GetStartupPort();
@ -132,7 +142,7 @@ namespace PlexRequests.UI
private static int GetStartupPort()
{
Log.Trace("Getting startup Port");
var port = 3579;
var port = 8080;
var service = new SettingsServiceV2<PlexRequestSettings>(new SettingsJsonRepository(new DbConfiguration(new SqliteFactory()), new MemoryCacheProvider()));
var settings = service.GetSettings();
Log.Trace("Port: {0}", settings.Port);
@ -148,5 +158,12 @@ namespace PlexRequests.UI
{
LoggingHelper.ConfigureLogging(connectionString);
}
private static void SetupSchedulers()
{
TaskManager.TaskFactory = new PlexTaskFactory();
TaskManager.Initialize(new PlexRegistry());
TaskManager.Initialize(new MediaCacheRegistry());
}
}
}

Loading…
Cancel
Save