Skip to content

Commit

Permalink
chore: review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
AnshulMalik committed Apr 7, 2024
1 parent c3b244c commit 4bb8c8e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion internal/insight/insight.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ func (in *Insight) Fetch(ctx context.Context, dbiResourceId string, dur time.Dur
samples := map[string]Samples{}
var wg sync.WaitGroup
var err error
var mu sync.Mutex

for _, chunk := range chunks {
chunk := chunk
Expand All @@ -81,8 +82,12 @@ func (in *Insight) Fetch(ctx context.Context, dbiResourceId string, dur time.Dur
defer wg.Done()

set, e := in.fetch(childContext, dbiResourceId, dur, chunk...)

mu.Lock()
defer mu.Unlock()

if e != nil {
if e != context.Canceled {
if err == nil {
cancel()
err = e
}
Expand Down

0 comments on commit 4bb8c8e

Please sign in to comment.