From 45db7d21b2a0a18b73253c64651a57c60880b084 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 31 Aug 2014 15:15:33 -0400 Subject: localize plugin installation process --- .../EntryPoints/LoadRegistrations.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'MediaBrowser.Server.Implementations/EntryPoints') diff --git a/MediaBrowser.Server.Implementations/EntryPoints/LoadRegistrations.cs b/MediaBrowser.Server.Implementations/EntryPoints/LoadRegistrations.cs index c2c4056f5..27170ced9 100644 --- a/MediaBrowser.Server.Implementations/EntryPoints/LoadRegistrations.cs +++ b/MediaBrowser.Server.Implementations/EntryPoints/LoadRegistrations.cs @@ -2,6 +2,8 @@ using MediaBrowser.Controller.Plugins; using MediaBrowser.Model.Logging; using System; +using System.Threading; +using System.Threading.Tasks; namespace MediaBrowser.Server.Implementations.EntryPoints { @@ -20,6 +22,8 @@ namespace MediaBrowser.Server.Implementations.EntryPoints /// private readonly ILogger _logger; + private Timer _timer; + /// /// Initializes a new instance of the class. /// @@ -35,7 +39,12 @@ namespace MediaBrowser.Server.Implementations.EntryPoints /// /// Runs this instance. /// - public async void Run() + public void Run() + { + _timer = new Timer(s => LoadAllRegistrations(), null, TimeSpan.FromMilliseconds(100), TimeSpan.FromHours(24)); + } + + private async Task LoadAllRegistrations() { try { @@ -52,6 +61,11 @@ namespace MediaBrowser.Server.Implementations.EntryPoints /// public void Dispose() { + if (_timer != null) + { + _timer.Dispose(); + _timer = null; + } } } } -- cgit v1.2.3