Skip to content

Commit

Permalink
Invert timesToUpload test in Upload
Browse files Browse the repository at this point in the history
  • Loading branch information
DrJosh9000 committed Oct 23, 2023
1 parent bbc101d commit 36dde7a
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions agent/header_times_streamer.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,17 @@ func (h *headerTimesStreamer) Upload(ctx context.Context) {
timesToUpload := len(times)

// Do we even have some times to upload
if timesToUpload > 0 {
// Call our callback with the times for upload
h.logger.Debug("[HeaderTimesStreamer] Uploading header times %d..%d", c, length-1)
h.uploadCallback(ctx, c, length, payload)
h.logger.Debug("[HeaderTimesStreamer] Finished uploading header times %d..%d", c, length-1)

// Decrement the wait group for every time we've uploaded.
h.uploadWaitGroup.Add(timesToUpload * -1)
if timesToUpload == 0 {
return
}

// Call our callback with the times for upload
h.logger.Debug("[HeaderTimesStreamer] Uploading header times %d..%d", c, length-1)
h.uploadCallback(ctx, c, length, payload)
h.logger.Debug("[HeaderTimesStreamer] Finished uploading header times %d..%d", c, length-1)

// Decrement the wait group for every time we've uploaded.
h.uploadWaitGroup.Add(timesToUpload * -1)
}

func (h *headerTimesStreamer) Stop() {
Expand Down

0 comments on commit 36dde7a

Please sign in to comment.