mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-03 04:19:18 +08:00
4fe363c4b2
Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
25 lines
475 B
Go
25 lines
475 B
Go
package datanode
|
|
|
|
import (
|
|
"sync"
|
|
|
|
"github.com/milvus-io/milvus/pkg/util/conc"
|
|
)
|
|
|
|
var ioPool *conc.Pool[any]
|
|
var ioPoolInitOnce sync.Once
|
|
|
|
func initIOPool() {
|
|
capacity := Params.DataNodeCfg.IOConcurrency.GetAsInt()
|
|
if capacity > 32 {
|
|
capacity = 32
|
|
}
|
|
// error only happens with negative expiry duration or with negative pre-alloc size.
|
|
ioPool = conc.NewPool[any](capacity)
|
|
}
|
|
|
|
func getOrCreateIOPool() *conc.Pool[any] {
|
|
ioPoolInitOnce.Do(initIOPool)
|
|
return ioPool
|
|
}
|