From 19d5dbdd4875214b782f425a3b9fea5b5550ac1e Mon Sep 17 00:00:00 2001 From: Andreas Wachter Date: Tue, 26 Mar 2024 07:25:21 +0100 Subject: [PATCH] added checks on mirrorinterval --- gitea/gitea.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gitea/gitea.go b/gitea/gitea.go index fe2351a..d17a1b1 100644 --- a/gitea/gitea.go +++ b/gitea/gitea.go @@ -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 ( @@ -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