diff --git a/gitregostore/gitstoreutils.go b/gitregostore/gitstoreutils.go index 6d518048..f3863b41 100644 --- a/gitregostore/gitstoreutils.go +++ b/gitregostore/gitstoreutils.go @@ -71,11 +71,15 @@ func (gs *GitRegoStore) setObjectsFromRepoLoop() { wg.Add(1) go func() { + f := true for { if err := gs.setObjectsFromRepoOnce(); err != nil { fmt.Println(err) } - wg.Done() + if f { + wg.Done() // first update to done + f = false + } if !gs.Watch { return } @@ -200,11 +204,15 @@ func (gs *GitRegoStore) setObjectsFromReleaseLoop() { var wg sync.WaitGroup wg.Add(1) go func() { + f := true for { if err := gs.setObjectsFromReleaseOnce(); err != nil { fmt.Println(err) } - wg.Done() + if f { + wg.Done() // first update to done + f = false + } if !gs.Watch { return }