Update sess_redis.go
修改redis重启后不会自动连接
Showing
1 changed file
with
3 additions
and
3 deletions
| ... | @@ -55,9 +55,9 @@ func (rp *RedisProvider) connectInit() redis.Conn { | ... | @@ -55,9 +55,9 @@ func (rp *RedisProvider) connectInit() redis.Conn { |
| 55 | return nil | 55 | return nil |
| 56 | } | 56 | } |
| 57 | return c*/ | 57 | return c*/ |
| 58 | if redisPool == nil { | 58 | //if redisPool == nil { |
| 59 | redisPool = make(chan redis.Conn, MAX_POOL_SIZE) | 59 | redisPool = make(chan redis.Conn, MAX_POOL_SIZE) |
| 60 | } | 60 | //} |
| 61 | if len(redisPool) == 0 { | 61 | if len(redisPool) == 0 { |
| 62 | go func() { | 62 | go func() { |
| 63 | for i := 0; i < MAX_POOL_SIZE/2; i++ { | 63 | for i := 0; i < MAX_POOL_SIZE/2; i++ { |
| ... | @@ -76,7 +76,7 @@ func putRedis(conn redis.Conn) { | ... | @@ -76,7 +76,7 @@ func putRedis(conn redis.Conn) { |
| 76 | if redisPool == nil { | 76 | if redisPool == nil { |
| 77 | redisPool = make(chan redis.Conn, MAX_POOL_SIZE) | 77 | redisPool = make(chan redis.Conn, MAX_POOL_SIZE) |
| 78 | } | 78 | } |
| 79 | if len(redisPool) == MAX_POOL_SIZE { | 79 | if len(redisPool) >= MAX_POOL_SIZE { |
| 80 | conn.Close() | 80 | conn.Close() |
| 81 | return | 81 | return |
| 82 | } | 82 | } | ... | ... |
-
Please register or sign in to post a comment