Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: respect ctx in cmds run within DialContext #620

Merged
merged 1 commit into from
Jul 1, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions redis/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,21 +291,21 @@ func DialContext(ctx context.Context, network, address string, options ...DialOp
authArgs = append(authArgs, do.username)
}
authArgs = append(authArgs, do.password)
if _, err := c.Do("AUTH", authArgs...); err != nil {
if _, err := c.DoContext(ctx, "AUTH", authArgs...); err != nil {
netConn.Close()
return nil, err
}
}

if do.clientName != "" {
if _, err := c.Do("CLIENT", "SETNAME", do.clientName); err != nil {
if _, err := c.DoContext(ctx, "CLIENT", "SETNAME", do.clientName); err != nil {
netConn.Close()
return nil, err
}
}

if do.db != 0 {
if _, err := c.Do("SELECT", do.db); err != nil {
if _, err := c.DoContext(ctx, "SELECT", do.db); err != nil {
netConn.Close()
return nil, err
}
Expand Down