Skip to content

Commit

Permalink
[fix] distributor: fix goroutine leak (#4238)
Browse files Browse the repository at this point in the history
Signed-off-by: fuling <fuling.lgz@alibaba-inc.com>
  • Loading branch information
liguozhong authored Aug 31, 2021
1 parent b36bc5a commit 6f78ffe
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/distributor/distributor.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,14 @@ func (d *Distributor) Push(ctx context.Context, req *logproto.PushRequest) (*log
case <-tracker.done:
return &logproto.PushResponse{}, validationErr
case <-ctx.Done():
go func() {
select {
case <-tracker.err:
return
case <-tracker.done:
return
}
}()
return nil, ctx.Err()
}
}
Expand Down

0 comments on commit 6f78ffe

Please sign in to comment.