From e4cffb6fb4626430e48b5cc7555fd00e1cb48d31 Mon Sep 17 00:00:00 2001 From: Michael Green <84688932+michael-j-green@users.noreply.github.com> Date: Wed, 11 Oct 2023 16:09:55 +1100 Subject: [PATCH] Revert "Added a check for the DB and a delay at start up if the database is not available (#148)" This reverts commit f9d6cc4bdca703567f9bf8ff8851b45919683158. --- gaseous-server/Program.cs | 18 +----------------- gaseous-tools/Database.cs | 26 -------------------------- 2 files changed, 1 insertion(+), 43 deletions(-) diff --git a/gaseous-server/Program.cs b/gaseous-server/Program.cs index badd79c..5741b72 100644 --- a/gaseous-server/Program.cs +++ b/gaseous-server/Program.cs @@ -12,24 +12,8 @@ using Microsoft.OpenApi.Models; Logging.WriteToDiskOnly = true; Logging.Log(Logging.LogType.Information, "Startup", "Starting Gaseous Server " + Assembly.GetExecutingAssembly().GetName().Version); -Database db = new gaseous_tools.Database(Database.databaseType.MySql, Config.DatabaseConfiguration.ConnectionString); - -// check db availability -bool dbOnline = false; -do -{ - Logging.Log(Logging.LogType.Information, "Startup", "Waiting for database..."); - if (db.TestConnection() == true) - { - dbOnline = true; - } - else - { - Thread.Sleep(30000); - } -} while (dbOnline == true); - // set up db +Database db = new gaseous_tools.Database(Database.databaseType.MySql, Config.DatabaseConfiguration.ConnectionString); db.InitDB(); // load app settings diff --git a/gaseous-tools/Database.cs b/gaseous-tools/Database.cs index a7ff6fd..1411d07 100644 --- a/gaseous-tools/Database.cs +++ b/gaseous-tools/Database.cs @@ -206,18 +206,6 @@ namespace gaseous_tools } } - public bool TestConnection() - { - switch (_ConnectorType) - { - case databaseType.MySql: - MySQLServerConnector conn = new MySQLServerConnector(_ConnectionString); - return conn.TestConnection(); - default: - return false; - } - } - public class SQLTransactionItem { public SQLTransactionItem() @@ -326,20 +314,6 @@ namespace gaseous_tools return cmd; } - public bool TestConnection() - { - MySqlConnection conn = new MySqlConnection(DBConn); - try - { - conn.Open(); - conn.Close(); - return true; - } - catch - { - return false; - } - } } } }