28 lines
506 B
Go
28 lines
506 B
Go
package grpc
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"git.loafle.net/commons_go/config"
|
|
cgp "git.loafle.net/commons_go/grpc_pool"
|
|
"git.loafle.net/commons_go/logging"
|
|
)
|
|
|
|
var _pool cgp.Pool
|
|
|
|
func InitializePool(ctx context.Context) {
|
|
var err error
|
|
h := &poolHandlers{
|
|
ctx: ctx,
|
|
}
|
|
h.cfg = config.Sub("grpc")
|
|
h.MaxIdle = h.cfg.GetInt("pool.MaxIdle")
|
|
h.MaxCapacity = h.cfg.GetInt("pool.MaxCapacity")
|
|
|
|
_pool, err = cgp.New(ctx, h)
|
|
if nil != err {
|
|
logging.Logger.Fatal(fmt.Sprintf("GRpc Pool: %v", err))
|
|
}
|
|
}
|