mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-05 05:18:52 +08:00
89b810a4db
Signed-off-by: Enwei Jiao <enwei.jiao@zilliz.com> Signed-off-by: Enwei Jiao <enwei.jiao@zilliz.com>
25 lines
496 B
Go
25 lines
496 B
Go
package datanode
|
|
|
|
import (
|
|
"sync"
|
|
|
|
"github.com/milvus-io/milvus/internal/util/concurrency"
|
|
)
|
|
|
|
var ioPool *concurrency.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, _ = concurrency.NewPool(capacity)
|
|
}
|
|
|
|
func getOrCreateIOPool() *concurrency.Pool {
|
|
ioPoolInitOnce.Do(initIOPool)
|
|
return ioPool
|
|
}
|