Example #1
0
        public async Task Stop()
        {
            if (_stopping)
            {
                return;
            }

            _log.Debug("GridDomain node {Id} is stopping", Id);
            _stopping = true;
            Container?.Dispose();

            try
            {
                _quartzScheduler?.Shutdown(false);
            }
            catch (Exception ex)
            {
                _log.Warn($"Got error on quartz scheduler shutdown: {ex}");
            }

            if (System != null)
            {
                await System.Terminate();

                System.Dispose();
            }

            _log.Debug("GridDomain node {Id} stopped", Id);
        }
Example #2
0
 public override void JobWasExecuted(IJobExecutionContext context, JobExecutionException jobException)
 {
     if (JobFailed(jobException) && this._retryStrategy.ShouldRetry(context, jobException))
     {
         ITrigger       trigger     = this._retryStrategy.GetTrigger(context);
         bool           unscheduled = context.Scheduler.UnscheduleJob(context.Trigger.Key);
         DateTimeOffset nextRunAt   = context.Scheduler.ScheduleJob(context.JobDetail, trigger);
         _logger.Warn("Restarting job {key}", context.JobDetail.Key.Name);
     }
 }
        private async Task RetryAsync(Func <Task> act, int maxCount = 3)
        {
            Exception ex;

            do
            {
                try
                {
                    await act();

                    return;
                }
                catch (Exception e)
                {
                    ex = e;
                    _log.Warn(e, "Got error on trying to execute a sql journal method, will retry");
                }
            } while (SqlAzureRetriableExceptionDetector.ShouldRetryOn(ex) && --maxCount > 0);

            _log.Error(ex, "Got fatal error trying to execute a sql journal method");
            ExceptionDispatchInfo.Capture(ex).Throw();
        }
Example #4
0
 public void LogWarn(string jobName, string message)
 {
     _coreLogger.Warn("Job {JobName} got a warning {Message}", jobName, message);
 }