mirror of
https://github.com/tgbot-collection/ytdlbot.git
synced 2025-02-25 07:44:13 +08:00
Update database.py - pymysql.err.InterfaceError: (0,”) error (#325)
check if the connection exists, and reconnect if disconnected.
This commit is contained in:
parent
682d7db2d6
commit
b3cabe3c3b
1 changed files with 1 additions and 0 deletions
|
@ -258,6 +258,7 @@ class MySQL:
|
|||
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()
|
||||
|
|
Loading…
Reference in a new issue