From b3cabe3c3b4c674d37a083ea078428aef465aeee Mon Sep 17 00:00:00 2001 From: cpanel10x Date: Mon, 25 Dec 2023 01:03:52 +0700 Subject: [PATCH] =?UTF-8?q?Update=20database.py=20-=20pymysql.err.Interfac?= =?UTF-8?q?eError:=20(0,=E2=80=9D)=20error=20(#325)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit check if the connection exists, and reconnect if disconnected. --- ytdlbot/database.py | 1 + 1 file changed, 1 insertion(+) diff --git a/ytdlbot/database.py b/ytdlbot/database.py index 4f5df0fe..f836987c 100644 --- a/ytdlbot/database.py +++ b/ytdlbot/database.py @@ -258,6 +258,7 @@ def __init__(self): self.con = pymysql.connect( host=MYSQL_HOST, user=MYSQL_USER, passwd=MYSQL_PASS, db="ytdl", charset="utf8mb4" ) + self.con.ping(reconnect = True) except Exception: logging.warning("MySQL connection failed, using fake mysql instead.") self.con = FakeMySQL()