milvus/internal/datanode/io_pool.go
jaime c9d0c157ec
Move some modules from internal to public package (#22572)
Signed-off-by: jaime <yun.zhang@zilliz.com>
2023-04-06 19:14:32 +08:00

25 lines
460 B
Go

package datanode
import (
"sync"
"github.com/milvus-io/milvus/pkg/util/conc"
)
var ioPool *conc.Pool
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(capacity)
}
func getOrCreateIOPool() *conc.Pool {
ioPoolInitOnce.Do(initIOPool)
return ioPool
}