BackgroundTaskRunner - add Hosted option, refactor some tasks

Conflicts:
	src/Umbraco.Web/Scheduling/BackgroundTaskRunner.cs
This commit is contained in:
Stephan
2015-07-10 15:52:58 +02:00
parent 0f56fa4baa
commit 34a9eef8b8
5 changed files with 27 additions and 24 deletions

View File

@@ -84,19 +84,13 @@ namespace Umbraco.Web.Scheduling
/// and returning a value indicating whether to repeat the task.</returns>
public abstract Task<bool> PerformRunAsync(CancellationToken token);
protected override void Dispose(bool disposing)
protected override void DisposeResources()
{
// lock on _timer instead of creating a new object as _timer is
// private, non-null, readonly - so safe here
lock (_timer)
{
if (_disposed) return;
_disposed = true;
base.DisposeResources();
// stop the timer
_timer.Change(Timeout.Infinite, Timeout.Infinite);
_timer.Dispose();
}
// stop the timer
_timer.Change(Timeout.Infinite, Timeout.Infinite);
_timer.Dispose();
}
}
}