Failed() public static method

public static Failed ( string reason ) : CheckResult
reason string
return CheckResult
 void DelayExecutionForFail(object state)
 {
     if (Builder != null)
     {
         if (delayExecutionFailTimer != null)
         {
             delayExecutionFailTimer.Dispose();
         }
         ReportToBackend(CheckResult.Failed((string)state));
     }
     else
     {
         if (delayExecutionFailTimer != null)
         {
             delayExecutionFailTimer.Change(2000, -1);
         }
         else
         {
             delayExecutionFailTimer = new Timer(DelayExecutionForFail, state, 2000, -1);
         }
     }
 }
Beispiel #2
0
        async Task Run()
        {
            CheckResult result;

            try
            {
                result = await customCheck.PerformCheck().ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                var reason = $"'{customCheck.GetType()}' implementation failed to run.";
                result = CheckResult.Failed(reason);
                Logger.Error(reason, ex);
            }

            try
            {
                await ReportToBackend(result, customCheck.Interval.HasValue?TimeSpan.FromTicks( customCheck.Interval.Value.Ticks * 4) : TimeSpan.MaxValue).ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                Logger.Error("Failed to report periodic check to ServiceControl.", ex);
            }
        }