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

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

@ -110,10 +110,7 @@ namespace PlexRequests.UI
SubscribeAllObservers(container); SubscribeAllObservers(container);
base.ConfigureRequestContainer(container, context); 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) protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)

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

Loading…
Cancel
Save