1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 13:00:54 +00:00

Update sess_redis.go

修改redis重启后不会自动连接
This commit is contained in:
yecrane 2013-05-22 22:26:26 +08:00
parent a2dd859e55
commit 67695fac9e

View File

@ -55,9 +55,9 @@ func (rp *RedisProvider) connectInit() redis.Conn {
return nil return nil
} }
return c*/ return c*/
if redisPool == nil { //if redisPool == nil {
redisPool = make(chan redis.Conn, MAX_POOL_SIZE) redisPool = make(chan redis.Conn, MAX_POOL_SIZE)
} //}
if len(redisPool) == 0 { if len(redisPool) == 0 {
go func() { go func() {
for i := 0; i < MAX_POOL_SIZE/2; i++ { for i := 0; i < MAX_POOL_SIZE/2; i++ {
@ -76,7 +76,7 @@ func putRedis(conn redis.Conn) {
if redisPool == nil { if redisPool == nil {
redisPool = make(chan redis.Conn, MAX_POOL_SIZE) redisPool = make(chan redis.Conn, MAX_POOL_SIZE)
} }
if len(redisPool) == MAX_POOL_SIZE { if len(redisPool) >= MAX_POOL_SIZE {
conn.Close() conn.Close()
return return
} }