28 lines
521 B
Go
28 lines
521 B
Go
package grpc
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"git.loafle.net/commons_go/config"
|
|
"git.loafle.net/commons_go/logging"
|
|
ogp "git.loafle.net/overflow/overflow_grpc_pool"
|
|
)
|
|
|
|
func NewPool(ctx context.Context) ogp.Pool {
|
|
h := &poolHandlers{
|
|
ctx: ctx,
|
|
logger: logging.WithContext(ctx),
|
|
}
|
|
h.cfg = config.Sub("grpc")
|
|
h.MaxIdle = h.cfg.GetInt("pool.MaxIdle")
|
|
h.MaxCapacity = h.cfg.GetInt("pool.MaxCapacity")
|
|
|
|
p, err := ogp.New(ctx, h)
|
|
if nil != err {
|
|
h.logger.Fatal(fmt.Sprintf("GRpc Pool: %v", err))
|
|
}
|
|
|
|
return p
|
|
}
|