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

View File

@@ -27,16 +27,6 @@ namespace NzbDrone.Core.Jobs
_logger = logger;
}
public void Handle(ApplicationStartedEvent message)
{
_cancellationTokenSource = new CancellationTokenSource();
Timer.Interval = 1000 * 30;
Timer.Elapsed += (o, args) => Task.Factory.StartNew(ExecuteCommands, _cancellationTokenSource.Token)
.LogExceptions();
Timer.Start();
}
private void ExecuteCommands()
{
try
@@ -70,8 +60,19 @@ namespace NzbDrone.Core.Jobs
}
}
public void Handle(ApplicationStartedEvent message)
{
_cancellationTokenSource = new CancellationTokenSource();
Timer.Interval = 1000 * 30;
Timer.Elapsed += (o, args) => Task.Factory.StartNew(ExecuteCommands, _cancellationTokenSource.Token)
.LogExceptions();
Timer.Start();
}
public void Handle(ApplicationShutdownRequested message)
{
_logger.Info("Shutting down scheduler");
_cancellationTokenSource.Cancel(true);
Timer.Stop();
}