1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-26 19:21:03 +03:00

Fix pool waiting for connection that was removed.

This commit is contained in:
Vladimir Mihailenco
2015-04-17 14:44:56 +03:00
parent 6d8aaa46d2
commit d3fb658fef
5 changed files with 74 additions and 45 deletions

View File

@ -160,10 +160,8 @@ type Options struct {
// The maximum number of socket connections.
// Default: 10
PoolSize int
// If all socket connections is the pool are busy, the pool will wait
// this amount of time for a conection to become available, before
// returning an error.
// Default: 5s
// PoolTimeout specifies amount of time client waits for a free
// connection in the pool. Default timeout is 1s.
PoolTimeout time.Duration
// Evict connections from the pool after they have been idle for longer
// than specified in this option.
@ -194,7 +192,7 @@ func (opt *Options) getDialTimeout() time.Duration {
func (opt *Options) getPoolTimeout() time.Duration {
if opt.PoolTimeout == 0 {
return 5 * time.Second
return 1 * time.Second
}
return opt.PoolTimeout
}