Skip to content

Move mc.cleanup inside mysqlConn watchCancel #1032

New issue

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

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

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,7 @@ func (mc *mysqlConn) watchCancel(ctx context.Context) error {
}
// When ctx is already cancelled, don't watch it.
if err := ctx.Err(); err != nil {
mc.cleanup()
return err
}
// When ctx is not cancellable, don't watch it.
Expand Down
1 change: 0 additions & 1 deletion connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ func (c *connector) Connect(ctx context.Context) (driver.Conn, error) {
// Call startWatcher for context support (From Go 1.8)
mc.startWatcher()
if err := mc.watchCancel(ctx); err != nil {
mc.cleanup()
return nil, err
}
defer mc.finish()
Expand Down