void mainTimer__Elapsed(object sender)
{
lock (_iterationLock)
{
try
{
PauseTimer();
LogProvider.Debug("WorkerRole is still alive.");
foreach (WorkerRoleTask task in _tasks)
{
task.Ping();
}
}
catch (Exception ex)
{
LogProvider.Error("WorkerRole failed to ping.", ex);
}
finally
{
try
{
ResumeTimer();
}
catch (Exception ex)
{
LogProvider.Error("WorkerRole could not resume the timer.", ex);
if (IsRunning)
ResetTimer();
}
}
}
}