Beispiel #1
0
 public RecurringRunPolicy(Duration every, ITimerFactory timerFactory, IClock clock) : base(every)
 {
     _every = every;
     _clock = clock;
     _timer = timerFactory.ExecuteActionOnInterval(ProcessTimerFired, every);
     Logger.Info($"Creating recurring run every {every}");
     _lastFired = clock.GetCurrentInstant();
 }
Beispiel #2
0
 protected T Wait()
 {
     Logger.Debug($"Waiting for {_taskDescription} to complete");
     using (_timerFactory.ExecuteActionOnInterval(DetermineIfTaskIsComplete, Duration.FromSeconds(2)))
     {
         var maximumWait = TimeSpan.FromMinutes(15);
         _autoResetEvent.WaitOne(maximumWait);
         Logger.Debug($"{_taskDescription} has completed");
     }
     return(_currentStatus);
 }
Beispiel #3
0
 public JobRunner(ITimerFactory timerFactory, IActionExecutor actionExecutor)
 {
     _timer          = timerFactory.ExecuteActionOnInterval(ProcessQueue, Duration.FromSeconds(15));
     _actionExecutor = actionExecutor;
 }