public SingletonTimerScope(ILog log, ISingletonLockHandle lockHandle, bool autoRelease, TimeSpan renewalInterval, CancellationTokenSource cancellationTokenSource) { _log = log; _lockHandle = lockHandle; _autoRelease = autoRelease; _renewalInterval = renewalInterval; _cts = cancellationTokenSource; _runningTask = Task.Run(async() => await TimerLoop(_cts.Token), _cts.Token); }
public SingletonTimerScope(ILog log, ISingletonLockHandle lockHandle, bool autoRelease) { _log = log; _lockHandle = lockHandle; _autoRelease = autoRelease; _timer = new Timer { AutoReset = true, Interval = TimeSpan.FromSeconds(30).TotalMilliseconds }; _timer.Elapsed += Timer_Elapsed; _timer.Enabled = true; }