cli: debug: various improvements (#995)

This commit is contained in:
Nils Hanke 2023-01-18 13:10:24 +01:00 committed by GitHub
parent fc2a285270
commit a3db3c8424
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 69 additions and 54 deletions

View file

@ -79,7 +79,7 @@ func (r *recoverCmd) recover(
return err
}
r.log.Debugf("Loading configuration file from %s", flags.configPath)
r.log.Debugf("Loading configuration file from %q", flags.configPath)
conf, err := config.New(fileHandler, flags.configPath)
if err != nil {
return displayConfigValidationErrors(cmd.ErrOrStderr(), err)
@ -119,17 +119,19 @@ func (r *recoverCmd) recoverCall(ctx context.Context, out io.Writer, interval ti
for {
once := sync.Once{}
retryOnceOnFailure := func(err error) bool {
var retry bool
// retry transient GCP LB errors
if grpcRetry.LoadbalancerIsNotReady(err) {
return true
retry = true
} else {
// retry connection errors once
// this is necessary because Azure's LB takes a while to remove unhealthy instances
once.Do(func() {
retry = grpcRetry.ServiceIsUnavailable(err)
})
}
retry := false
// retry connection errors once
// this is necessary because Azure's LB takes a while to remove unhealthy instances
once.Do(func() {
retry = grpcRetry.ServiceIsUnavailable(err)
})
r.log.Debugf("Encountered error (retriable: %t): %s", retry, err)
return retry
}
@ -268,7 +270,7 @@ func (r *recoverCmd) parseRecoverFlags(cmd *cobra.Command, fileHandler file.Hand
if err != nil {
return recoverFlags{}, fmt.Errorf("parsing config path argument: %w", err)
}
r.log.Debugf("Config path flag is %s", configPath)
r.log.Debugf("Configuration path flag is %s", configPath)
return recoverFlags{
endpoint: endpoint,