1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2026-04-26 22:56:23 -04:00

Shutdown working on mono

This commit is contained in:
markus101
2014-02-03 23:11:36 -08:00
committed by Mark McDowall
parent aa1a76fe72
commit 6ff9c9f61e
6 changed files with 43 additions and 15 deletions
+5 -1
View File
@@ -1,5 +1,6 @@
using System.Threading;
using System.Threading.Tasks;
using NLog;
using NzbDrone.Common.TPL;
using NzbDrone.Core.Lifecycle;
using NzbDrone.Core.Messaging.Events;
@@ -11,12 +12,14 @@ namespace NzbDrone.Core.Queue
IHandle<ApplicationShutdownRequested>
{
private readonly IEventAggregator _eventAggregator;
private readonly Logger _logger;
private static readonly Timer Timer = new Timer();
private static CancellationTokenSource _cancellationTokenSource;
public QueueScheduler(IEventAggregator eventAggregator)
public QueueScheduler(IEventAggregator eventAggregator, Logger logger)
{
_eventAggregator = eventAggregator;
_logger = logger;
}
private void CheckQueue()
@@ -47,6 +50,7 @@ namespace NzbDrone.Core.Queue
public void Handle(ApplicationShutdownRequested message)
{
_logger.Info("Shutting down queue scheduler");
_cancellationTokenSource.Cancel(true);
Timer.Stop();
}