remove inline retry attempts -> #174

This commit is contained in:
6543 2023-02-10 02:27:57 +01:00
parent d7a403f077
commit 561d54153e
1 changed files with 2 additions and 16 deletions

View File

@ -29,22 +29,8 @@ func (o *Options) CheckCanonicalDomain(giteaClient *gitea.Client, actualDomain,
return domains[0], valid
}
var body []byte
var err error
// Make a request to the Gitea instance.
// Do at least three attempts before bailing out.
for i := 0; i < 3; i++ {
body, err = giteaClient.GiteaRawContent(o.TargetOwner, o.TargetRepo, o.TargetBranch, canonicalDomainConfig)
if err == nil || err == gitea.ErrorNotFound {
break
}
// Only log the error on the last iteration.
if i != 2 {
continue
}
body, err := giteaClient.GiteaRawContent(o.TargetOwner, o.TargetRepo, o.TargetBranch, canonicalDomainConfig)
if err == nil || err == gitea.ErrorNotFound {
log.Info().Err(err).Msgf("could not read %s of %s/%s", canonicalDomainConfig, o.TargetOwner, o.TargetRepo)
}