[fix] distributor: fix goroutine leak (#4238)

Signed-off-by: fuling <fuling.lgz@alibaba-inc.com>
pull/4240/head
李国忠 4 years ago committed by GitHub
parent b36bc5ab32
commit 6f78ffe33c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      pkg/distributor/distributor.go

@ -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()
}
}

Loading…
Cancel
Save