cache branch not found and only log error if error != NotFound

This commit is contained in:
6543 2022-11-11 15:27:18 +01:00
parent 7526873049
commit 8c3b74518c
No known key found for this signature in database
GPG key ID: B8BE6D610E61C862
3 changed files with 18 additions and 2 deletions

View file

@ -1,6 +1,8 @@
package upstream
import (
"errors"
"github.com/rs/zerolog/log"
"codeberg.org/codeberg/pages/server/gitea"
@ -24,7 +26,9 @@ func GetBranchTimestamp(giteaClient *gitea.Client, owner, repo, branch string) *
timestamp, err := giteaClient.GiteaGetRepoBranchTimestamp(owner, repo, branch)
if err != nil {
log.Err(err).Msg("Could not get latest commit's timestamp from branch")
if !errors.Is(err, gitea.ErrorNotFound) {
log.Error().Err(err).Msg("Could not get latest commit's timestamp from branch")
}
return nil
}
log.Debug().Msgf("Succesfully fetched latest commit's timestamp from branch: %#v", timestamp)