示例#1
0
        public static bool TryLoadFromGitConfig(ITracer tracer, GitProcess git, out RetryConfig retryConfig, out string error)
        {
            // TODO 1026787: Log failures to event log

            retryConfig = null;

            int maxRetries;

            if (!TryLoadMaxRetries(git, out maxRetries, out error))
            {
                if (tracer != null)
                {
                    tracer.RelatedError(
                        new EventMetadata
                    {
                        { "Area", EtwArea },
                        { "error", error },
                        { "ErrorMessage", "TryLoadConfig: TryLoadMaxRetries failed" }
                    });
                }

                return(false);
            }

            TimeSpan timeout;

            if (!TryLoadTimeout(git, out timeout, out error))
            {
                if (tracer != null)
                {
                    tracer.RelatedError(
                        new EventMetadata
                    {
                        { "Area", EtwArea },
                        { "maxRetries", maxRetries },
                        { "error", error },
                        { "ErrorMessage", "TryLoadConfig: TryLoadTimeout failed" }
                    });
                }

                return(false);
            }

            retryConfig = new RetryConfig(maxRetries, timeout);

            if (tracer != null)
            {
                tracer.RelatedEvent(
                    EventLevel.Informational,
                    "RetryConfig_LoadedRetryConfig",
                    new EventMetadata
                {
                    { "Area", EtwArea },
                    { "Timeout", retryConfig.Timeout },
                    { "MaxRetries", retryConfig.MaxRetries },
                    { "Message", "RetryConfigLoaded" }
                });
            }

            return(true);
        }
示例#2
0
 public static bool TryLoadFromGitConfig(ITracer tracer, Enlistment enlistment, out RetryConfig retryConfig, out string error)
 {
     return(TryLoadFromGitConfig(tracer, new GitProcess(enlistment), out retryConfig, out error));
 }