Skip to content

sqlx.Connect: Close db connection if db.Ping() fails - #370

Merged
jmoiron merged 1 commit into
jmoiron:masterfrom
somersf:connect-close-on-error
Nov 29, 2017
Merged

jmoiron merged 1 commit into
jmoiron:masterfrom
somersf:connect-close-on-error

Conversation

@somersf

@somersf somersf commented Nov 29, 2017

Copy link
Copy Markdown
Contributor

If the db open succeeds but the Ping() fails, close the
connection and return nil along with the error to prevent
resource leakage.

Fixes #366

If the db open succeeds but the Ping() fails, close the
connection and return nil along with the error to prevent
resource leakage.

Fixes jmoiron#366
@jmoiron
jmoiron merged commit 99f3ad6 into jmoiron:master Nov 29, 2017
@somersf
somersf deleted the connect-close-on-error branch November 29, 2017 23:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sqlx.Connect - close db connection if db.Ping() fails

2 participants