This commit is contained in:
tidusjar 2016-04-12 12:32:27 +01:00
parent 3261bdbf9b
commit 7679a13254
3 changed files with 23 additions and 6 deletions

View file

@ -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);
}