fix: Move init kafka pool into once (#37786)

Introduced by #37744

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
This commit is contained in:
congqixia 2024-11-18 21:24:48 +08:00 committed by GitHub
parent 351463b67e
commit 97b7ebbc08
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -34,15 +34,17 @@ var (
) )
func initPool() { func initPool() {
pool := conc.NewPool[any]( initOnce.Do(func() {
hardware.GetCPUNum(), pool := conc.NewPool[any](
conc.WithPreAlloc(false), hardware.GetCPUNum(),
conc.WithDisablePurge(false), conc.WithPreAlloc(false),
conc.WithPreHandler(runtime.LockOSThread), // lock os thread for cgo thread disposal conc.WithDisablePurge(false),
) conc.WithPreHandler(runtime.LockOSThread), // lock os thread for cgo thread disposal
)
kafkaCPool.Store(pool) kafkaCPool.Store(pool)
log.Info("init dynamicPool done", zap.Int("size", hardware.GetCPUNum())) log.Info("init dynamicPool done", zap.Int("size", hardware.GetCPUNum()))
})
} }
// GetSQPool returns the singleton pool instance for search/query operations. // GetSQPool returns the singleton pool instance for search/query operations.