diff --git a/session/redis/sess_redis.go b/session/redis/sess_redis.go index d0424515..55595851 100644 --- a/session/redis/sess_redis.go +++ b/session/redis/sess_redis.go @@ -160,10 +160,13 @@ func (rp *Provider) SessionInit(maxlifetime int64, savePath string) error { return nil, err } } - _, err = c.Do("SELECT", rp.dbNum) - if err != nil { - c.Close() - return nil, err + //some redis proxy such as twemproxy is not support select command + if rp.dbNum > 0 { + _, err = c.Do("SELECT", rp.dbNum) + if err != nil { + c.Close() + return nil, err + } } return c, err }, rp.poolsize)