From 1f8404cb6a91855dbc3a07a197a87c6d34b26730 Mon Sep 17 00:00:00 2001 From: Chao Xu Date: Mon, 1 Jun 2015 11:13:37 -0700 Subject: [PATCH] let the contrib/git-sync use a for-loop, rather than relying on the pod's restart policy, to periodically pull from the repo --- contrib/git-sync/main.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/contrib/git-sync/main.go b/contrib/git-sync/main.go index 201e7515cd7..0222ad27e16 100644 --- a/contrib/git-sync/main.go +++ b/contrib/git-sync/main.go @@ -66,12 +66,14 @@ func main() { if _, err := exec.LookPath("git"); err != nil { log.Fatalf("required git executable not found: %v", err) } - if err := syncRepo(*flRepo, *flDest, *flBranch, *flRev); err != nil { - log.Fatalf("error syncing repo: %v", err) + for { + if err := syncRepo(*flRepo, *flDest, *flBranch, *flRev); err != nil { + log.Fatalf("error syncing repo: %v", err) + } + log.Printf("wait %d seconds", *flWait) + time.Sleep(time.Duration(*flWait) * time.Second) + log.Println("done") } - log.Printf("wait %d seconds", *flWait) - time.Sleep(time.Duration(*flWait) * time.Second) - log.Println("done") } // syncRepo syncs the branch of a given repository to the destination at the given rev.