Skip to content

Commit

Permalink
fix: fix race in http sync test
Browse files Browse the repository at this point in the history
Signed-off-by: Todd Baert <[email protected]>
  • Loading branch information
toddbaert committed Feb 13, 2023
1 parent 9d7dbd1 commit c07027b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/sync/http/http_sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ func (hs *Sync) Sync(ctx context.Context, dataSync chan<- sync.DataSync) error {
return err
}

dataSync <- sync.DataSync{FlagData: fetch, Source: hs.URI, Type: sync.ALL}

_ = hs.Cron.AddFunc("*/5 * * * *", func() {
body, err := hs.fetchBodyFromURL(ctx, hs.URI)
if err != nil {
Expand Down Expand Up @@ -82,6 +80,9 @@ func (hs *Sync) Sync(ctx context.Context, dataSync chan<- sync.DataSync) error {
})

hs.Cron.Start()

dataSync <- sync.DataSync{FlagData: fetch, Source: hs.URI, Type: sync.ALL}

<-ctx.Done()
hs.Cron.Stop()

Expand Down

0 comments on commit c07027b

Please sign in to comment.