Skip to content

Commit

Permalink
fixed loop signaling
Browse files Browse the repository at this point in the history
  • Loading branch information
dwertent committed Nov 8, 2021
1 parent c4e0136 commit 25e7edc
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions gitregostore/gitstoreutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 25e7edc

Please sign in to comment.