mirror of
https://github.com/redis/go-redis.git
synced 2025-12-02 06:22:31 +03:00
Update redis.go
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
3
redis.go
3
redis.go
@@ -415,11 +415,12 @@ func (c *baseClient) initConn(ctx context.Context, cn *pool.Conn) error {
|
||||
} else {
|
||||
// DialTimeout is shorter, cap the wait at DialTimeout
|
||||
waitCtx, cancel = context.WithTimeout(ctx, dialTimeout)
|
||||
defer cancel()
|
||||
}
|
||||
} else {
|
||||
// No command deadline, use DialTimeout to prevent waiting indefinitely
|
||||
waitCtx, cancel = context.WithTimeout(ctx, dialTimeout)
|
||||
}
|
||||
if cancel != nil {
|
||||
defer cancel()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user