private void LogInformation(string format, params object[] args) { var message = string.Format(format, args); _analytics.JobEvent(JobName, message, Constants.ContinuousPath, string.Empty); _continuousJobLogger.LogInformation(message); }
private void OnMakeChanges(object state) { HashSet <string> updatedJobs; lock (_lockObject) { if (_makingChanges) { _makeChangesTimer.Change(TimeoutUntilMakingChanges, Timeout.Infinite); return; } _makingChanges = true; updatedJobs = _updatedJobs; _updatedJobs = new HashSet <string>(); } foreach (string updatedJobName in updatedJobs) { // job initialization and changed come thru this code path _analytics.JobEvent(updatedJobName, "Job initializing", _jobType, String.Empty); try { _onJobChanged(updatedJobName); _analytics.JobEvent(updatedJobName, "Job initialization success", _jobType, String.Empty); } catch (Exception ex) { _analytics.JobEvent(updatedJobName, "Job initialization failed", _jobType, ex.ToString()); _traceFactory.GetTracer().TraceError(ex); } } _makingChanges = false; FirstTimeMakingChanges = false; }
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); }