From c20251b46278eeb7d12eb8bd93446a91c6b7e51f Mon Sep 17 00:00:00 2001 From: Azareal Date: Wed, 29 Aug 2018 11:59:43 +1000 Subject: [PATCH] Oops, don't kill Gosora when the Unix socket isn't present. --- query_gen/lib/mysql.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/query_gen/lib/mysql.go b/query_gen/lib/mysql.go index a1c70545..bdf725f7 100644 --- a/query_gen/lib/mysql.go +++ b/query_gen/lib/mysql.go @@ -57,12 +57,10 @@ func (adapter *MysqlAdapter) BuildConn(config map[string]string) (*sql.DB, error } db, err := sql.Open("mysql", config["username"]+dbpassword+"@unix("+dbsocket+")/"+config["name"]+"?collation="+dbCollation+"&parseTime=true") - if err != nil { - return db, err + if err == nil { + // Make sure that the connection is alive + return db, db.Ping() } - - // Make sure that the connection is alive - return db, db.Ping() } // Open the database connection