mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-07 01:28:27 +08:00
25 lines
465 B
Go
25 lines
465 B
Go
package datanode
|
|
|
|
import (
|
|
"sync"
|
|
|
|
"github.com/milvus-io/milvus/internal/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
|
|
}
|