in src/WebJobs.Extensions/Extensions/Timers/Listener/TimerListener.cs [422:453]
private void StartTimer(TimeSpan interval)
{
// Restart the timer with the next schedule occurrence, but only
// if Cancel, Stop, and Dispose have not been called.
if (_cancellationTokenSource.IsCancellationRequested)
{
return;
}
_timer = new System.Timers.Timer
{
AutoReset = false
};
_timer.Elapsed += OnTimer;
if (interval > MaxTimerInterval)
{
// if the interval exceeds the maximum interval supported by Timer,
// store the remainder and use the max
_remainingInterval = interval - MaxTimerInterval;
interval = MaxTimerInterval;
}
else
{
// clear out any remaining interval
_remainingInterval = TimeSpan.Zero;
}
_timer.Interval = interval.TotalMilliseconds;
_timer.Start();
Logger.TimerStarted(_logger, _functionLogName, interval);
}