Example #1
0
        private void FullRestartTimerCallback(object?parameter)
        {
            if (UpdateTimer != null)
            {
                AddLog("Restarting the timer");

                // Restart the update timer from scratch.
                UpdateTimer.Change(Timeout.InfiniteTimeSpan, Timeout.InfiniteTimeSpan);

                UpdateTimer = new Timer(new TimerCallback(UpdateTimerCallback));
                UpdateTimer.Change(TimeInterval, TimeInterval);

                AddLog("Timer restarted");
            }
            else
            {
                AddLog("No timer to restart");
            }

            FullRestartTimer?.Change(FullRestartInterval, Timeout.InfiniteTimeSpan);
            AddLog($"Next check scheduled at {DateTime.UtcNow + FullRestartInterval}");
        }
Example #2
0
 private void StopServiceManager()
 {
     FullRestartTimer.Change(Timeout.InfiniteTimeSpan, Timeout.InfiniteTimeSpan);
     UpdateTimer.Change(Timeout.InfiniteTimeSpan, Timeout.InfiniteTimeSpan);
 }