diff --git a/app/vminsert/netstorage/insert_ctx_pool.go b/app/vminsert/netstorage/insert_ctx_pool.go index 8a10475e4e..6b2f4b2c71 100644 --- a/app/vminsert/netstorage/insert_ctx_pool.go +++ b/app/vminsert/netstorage/insert_ctx_pool.go @@ -2,23 +2,16 @@ package netstorage import ( "sync" - - "github.com/VictoriaMetrics/VictoriaMetrics/lib/cgroup" ) // GetInsertCtx returns InsertCtx from the pool. // // Call PutInsertCtx for returning it to the pool. func GetInsertCtx() *InsertCtx { - select { - case ctx := <-insertCtxPoolCh: - return ctx - default: - if v := insertCtxPool.Get(); v != nil { - return v.(*InsertCtx) - } - return &InsertCtx{} + if v := insertCtxPool.Get(); v != nil { + return v.(*InsertCtx) } + return &InsertCtx{} } // PutInsertCtx returns ctx to the pool. @@ -26,12 +19,7 @@ func GetInsertCtx() *InsertCtx { // ctx cannot be used after the call. func PutInsertCtx(ctx *InsertCtx) { ctx.Reset() - select { - case insertCtxPoolCh <- ctx: - default: - insertCtxPool.Put(ctx) - } + insertCtxPool.Put(ctx) } var insertCtxPool sync.Pool -var insertCtxPoolCh = make(chan *InsertCtx, cgroup.AvailableCPUs())