From a095621ce4cab20a7405e1c5a58ef66e1d2d9238 Mon Sep 17 00:00:00 2001 From: sgoudham Date: Tue, 28 Jul 2020 20:51:26 +0100 Subject: [PATCH] Getting rid of previous "blocking" connection --- db.py | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/db.py b/db.py index 9c7c711c..3e51150f 100644 --- a/db.py +++ b/db.py @@ -1,8 +1,6 @@ import asyncio -import sys import aiomysql -import mariadb from decouple import config # Get password/host from .env @@ -23,23 +21,6 @@ async def connection(loop): return pool +# Make sure the connection is setup before the bot is ready loop = asyncio.get_event_loop() loop.run_until_complete(connection(loop)) - - -# Defining connection for when the bot isn't ready yet -def startup_connection(): - try: - conn = mariadb.connect( - user="hamothy", - password=password, - host=host, - port=3306, - database="enso" - ) - except mariadb.Error as e: - print(f"Error connecting to MariaDB Platform: {e}") - sys.exit(1) - - # Returning connection string - return conn