config has been changed.

This commit is contained in:
crusader
2017-09-19 17:28:21 +09:00
parent 918775c49b
commit 0bc87ebdc5
11 changed files with 71 additions and 85 deletions

View File

@@ -4,7 +4,8 @@ import (
"context"
"time"
"git.loafle.net/commons_go/config"
"git.loafle.net/overflow/overflow_gateway_web/conf"
rp "git.loafle.net/commons_go/redis_pool"
)
@@ -12,9 +13,9 @@ func NewPool(ctx context.Context) rp.Pool {
h := &poolHandlers{
ctx: ctx,
}
h.cfg = config.Sub("redis")
h.MaxIdle = h.cfg.GetInt("pool.MaxIdle")
h.IdleTimeout = h.cfg.GetDuration("pool.IdleTimeout") * time.Second
h.MaxIdle = conf.Config.Redis.Pool.MaxIdle
h.IdleTimeout = conf.Config.Redis.Pool.IdleTimeout * time.Second
p := rp.NewPool(ctx, h)

View File

@@ -4,20 +4,18 @@ import (
"context"
"time"
"github.com/garyburd/redigo/redis"
"git.loafle.net/commons_go/config"
rp "git.loafle.net/commons_go/redis_pool"
"git.loafle.net/overflow/overflow_gateway_web/conf"
"github.com/garyburd/redigo/redis"
)
type poolHandlers struct {
rp.PoolHandlers
ctx context.Context
cfg config.Configurator
}
func (h *poolHandlers) Dial() (redis.Conn, error) {
return redis.Dial(h.cfg.GetString("network"), h.cfg.GetString("addr"))
return redis.Dial(conf.Config.Redis.Network, conf.Config.Redis.Addr)
}
func (h *poolHandlers) TestOnBorrow(c redis.Conn, t time.Time) error {