config has been changed.
This commit is contained in:
@@ -4,9 +4,9 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"git.loafle.net/commons_go/config"
|
||||
cgp "git.loafle.net/commons_go/grpc_pool"
|
||||
"git.loafle.net/commons_go/logging"
|
||||
"git.loafle.net/overflow/overflow_gateway_web/conf"
|
||||
)
|
||||
|
||||
var _pool cgp.Pool
|
||||
@@ -16,9 +16,9 @@ func InitializePool(ctx context.Context) {
|
||||
h := &poolHandlers{
|
||||
ctx: ctx,
|
||||
}
|
||||
h.cfg = config.Sub("grpc")
|
||||
h.MaxIdle = h.cfg.GetInt("pool.MaxIdle")
|
||||
h.MaxCapacity = h.cfg.GetInt("pool.MaxCapacity")
|
||||
|
||||
h.MaxIdle = conf.Config.GRPC.Pool.MaxIdle
|
||||
h.MaxCapacity = conf.Config.GRPC.Pool.MaxCapacity
|
||||
|
||||
_pool, err = cgp.New(ctx, h)
|
||||
if nil != err {
|
||||
|
||||
@@ -5,20 +5,19 @@ import (
|
||||
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"git.loafle.net/commons_go/config"
|
||||
cgp "git.loafle.net/commons_go/grpc_pool"
|
||||
oas "git.loafle.net/overflow/overflow_api_server/golang"
|
||||
"git.loafle.net/overflow/overflow_gateway_web/conf"
|
||||
)
|
||||
|
||||
type poolHandlers struct {
|
||||
cgp.PoolHandlers
|
||||
ctx context.Context
|
||||
cfg config.Configurator
|
||||
}
|
||||
|
||||
func (h *poolHandlers) OnCreate() (*grpc.ClientConn, interface{}, error) {
|
||||
var err error
|
||||
conn, err := grpc.Dial(config.GetString("grpc.addr"), grpc.WithInsecure())
|
||||
conn, err := grpc.Dial(conf.Config.GRPC.Addr, grpc.WithInsecure())
|
||||
if nil != err {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user