mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2025-04-24 22:06:57 +00:00
remove inline retry attempts -> #174
This commit is contained in:
parent
d7a403f077
commit
561d54153e
1 changed files with 2 additions and 16 deletions
|
@ -29,22 +29,8 @@ func (o *Options) CheckCanonicalDomain(giteaClient *gitea.Client, actualDomain,
|
||||||
return domains[0], valid
|
return domains[0], valid
|
||||||
}
|
}
|
||||||
|
|
||||||
var body []byte
|
body, err := giteaClient.GiteaRawContent(o.TargetOwner, o.TargetRepo, o.TargetBranch, canonicalDomainConfig)
|
||||||
var err error
|
if err == nil || err == gitea.ErrorNotFound {
|
||||||
|
|
||||||
// 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
|
|
||||||
}
|
|
||||||
|
|
||||||
log.Info().Err(err).Msgf("could not read %s of %s/%s", canonicalDomainConfig, o.TargetOwner, o.TargetRepo)
|
log.Info().Err(err).Msgf("could not read %s of %s/%s", canonicalDomainConfig, o.TargetOwner, o.TargetRepo)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue