refactor Scheduler to use new BackgroundTaskRunner capabilities

Conflicts:
	src/Umbraco.Web/Scheduling/Scheduler.cs
This commit is contained in:
Stephan
2015-02-06 18:10:19 +01:00
committed by Shannon
parent b7436dc55f
commit a73b7a5849
6 changed files with 113 additions and 118 deletions

View File

@@ -67,12 +67,17 @@ namespace Umbraco.Web.Scheduling
var recur = GetRecurring();
if (recur == null) return; // done
// note
// must use the single-parameter constructor on Timer to avoid it from being GC'd
// read http://stackoverflow.com/questions/4962172/why-does-a-system-timers-timer-survive-gc-but-not-system-threading-timer
_timer = new Timer(_ =>
{
_timer.Dispose();
_timer = null;
_runner.TryAdd(recur);
}, null, _periodMilliseconds, 0);
});
_timer.Change(_periodMilliseconds, 0);
}
/// <summary>