diff --git a/rdb.go b/rdb.go index fca9266..90f7bfd 100644 --- a/rdb.go +++ b/rdb.go @@ -140,18 +140,21 @@ func newRedisPool(s RdSettings, logger logr.Logger) *redis.Pool { idleTimeoutSec = 240 } + connStr := s.ConnStr() + + if len(s.Prefix) > 0 { + logger = logger.WithName("[" + s.Prefix + "]") + } + return &redis.Pool{ Wait: false, MaxIdle: maxIdle, IdleTimeout: time.Second * time.Duration(idleTimeoutSec), Dial: func() (redis.Conn, error) { - orig, err := redis.Dial("tcp", s.ConnStr()) + orig, err := redis.Dial("tcp", connStr) if err != nil { return nil, errors.WithStack(err) } - if len(s.Prefix) > 0 { - logger = logger.WithName("[" + s.Prefix + "]") - } c := &rdb{ orig: orig, name: s.Prefix,