private void OnTimer(object state) { var timers = _runtime.PersistenceProvider.GetTimersToExecute(); foreach (var timer in timers) { try { _runtime.ExecuteTimer(timer.ProcessId, timer.Name); } finally { _runtime.PersistenceProvider.ClearTimer(timer.TimerId); } } RefreshInterval(); }
private async Task ExecuteTimer(TimerToExecute timer, CancellationToken token) { if (token.IsCancellationRequested) { _runtime.PersistenceProvider.ClearTimerIgnore(timer.TimerId); return; } try { var timerToExecute = timer; await _runtime.ExecuteTimer(timerToExecute.ProcessId, timerToExecute.Name); } // After implementing logger insert log here catch (ImpossibleToSetStatusException) {} catch (ProcessNotFoundException) {} finally { _runtime.PersistenceProvider.ClearTimer(timer.TimerId); } }