Skip to content

Commit

Permalink
added checks on mirrorinterval
Browse files Browse the repository at this point in the history
  • Loading branch information
cooperspencer committed Mar 26, 2024
1 parent ac9fae4 commit 19d5dbd
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions gitea/gitea.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/cooperspencer/gickup/logger"
"github.com/cooperspencer/gickup/types"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
)

var (
Expand Down Expand Up @@ -148,10 +149,17 @@ func Backup(r types.Repo, d types.GenRepo, dry bool) bool {
return true
}

_, err = time.ParseDuration(d.MirrorInterval)
if err != nil {
log.Warn().Msgf("%s is not a valid duration!", d.MirrorInterval)
d.MirrorInterval = repo.MirrorInterval
}

if d.MirrorInterval != repo.MirrorInterval {
_, _, err := giteaclient.EditRepo(user.UserName, r.Name, gitea.EditRepoOption{MirrorInterval: &d.MirrorInterval})
if err != nil {
sub.Error().
Err(err).
Msgf("Couldn't update %s", types.Red(r.Name))
}
return false
Expand Down

0 comments on commit 19d5dbd

Please sign in to comment.