private void StartTimer()
{
try
{
if (_disposed)
throw new ObjectDisposedException("RepeatingWorkerRoleTask");
lock (_timerLock)
{
TimeSpan duration = TimeSpan.FromSeconds(Math.Max(1, WaitingPeriodSeconds));
_mainTimer = new Timer(mainTimer__Elapsed, null, duration, duration);
_nextIterationTimestamp = DateTime.UtcNow.AddSeconds(Math.Max(1, WaitingPeriodSeconds));
CheckIn();
}
}
catch (Exception ex)
{
LogProvider.ErrorFormat("Timer could not be started for task '{0}'", ex, Name);
}
}