Skip to content

Commit

Permalink
Wait for the streaming goroutine to finish before returning (#816)
Browse files Browse the repository at this point in the history
  • Loading branch information
jalvz committed Sep 9, 2020
1 parent 489947b commit 2aef45b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tracer.go
Expand Up @@ -765,8 +765,13 @@ func (t *Tracer) loop() {
// Run another goroutine to perform the blocking requests,
// communicating with the tracer loop to obtain stream data.
sendStreamRequest := make(chan time.Duration)
defer close(sendStreamRequest)
done := make(chan struct{})
defer func() {
close(sendStreamRequest)
<-done
}()
go func() {
defer close(done)
jitterRand := rand.New(rand.NewSource(time.Now().UnixNano()))
for gracePeriod := range sendStreamRequest {
if gracePeriod > 0 {
Expand Down

0 comments on commit 2aef45b

Please sign in to comment.