Fix ctx confusion caused goroutine leakage (#20017)

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
pull/20031/head
congqixia 2022-10-24 14:31:29 +08:00 committed by GitHub
parent 868bdd504d
commit 454ff2f1df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 7 deletions

View File

@ -29,9 +29,6 @@ import (
)
type queryShard struct {
ctx context.Context
cancel context.CancelFunc
collectionID UniqueID
collection *Collection // quick reference from meta
channel Channel
@ -80,10 +77,7 @@ func newQueryShard(
return nil, err
}
ctx, cancel := context.WithCancel(ctx)
qs := &queryShard{
ctx: ctx,
cancel: cancel,
collectionID: collectionID,
collection: collection,
channel: channel,
@ -104,7 +98,9 @@ func newQueryShard(
// Close cleans query shard
func (q *queryShard) Close() {
q.cancel()
if q.vectorChunkManager != nil {
q.vectorChunkManager.Close()
}
}
type tsType int32