Example #1
0
        public void Reschedule(DateTime lastRun, Schedule schedule = null)
        {
            Schedule = schedule ?? Schedule;

            var nextInterval = Schedule.GetNextInterval(lastRun);

            // Limit next interval to 40 days so it won't conflict with the maximum time allowed to set a timer.
            nextInterval = nextInterval < MaximumTimeSpanInterval ? nextInterval : MaximumTimeSpanInterval;

            if (schedule != null)
            {
                Logger.LogInformation("Scheduling WebJob with " + schedule + " next schedule expected in " + nextInterval);
            }
            else
            {
                Logger.LogInformation("Next schedule expected in " + nextInterval);
            }

            _timer.Change(nextInterval, Timeout.InfiniteTimeSpan);
        }
        public void Reschedule(DateTime lastRun, Schedule schedule = null)
        {
            Schedule = schedule ?? Schedule;

            var nextInterval = Schedule.GetNextInterval(lastRun);

            // Limit next interval to 40 days so it won't conflict with the maximum time allowed to set a timer.
            nextInterval = nextInterval < MaximumTimeSpanInterval ? nextInterval : MaximumTimeSpanInterval;

            if (schedule != null)
            {
                Logger.LogInformation("Scheduling WebJob with " + schedule + " next schedule expected in " + nextInterval);
            }
            else
            {
                Logger.LogInformation("Next schedule expected in " + nextInterval);
            }

            _analytics.JobEvent(TriggeredJob.Name.Fuzz(), $"Reschedule {nextInterval}", TriggeredJob.JobType, String.Empty);

            _timer.Change(nextInterval, Timeout.InfiniteTimeSpan);
        }