mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-02 03:55:55 +00:00
fix: 修复session维护过程的bug
This commit is contained in:
6
main.py
6
main.py
@@ -53,5 +53,11 @@ if __name__ == '__main__':
|
|||||||
try:
|
try:
|
||||||
time.sleep(86400)
|
time.sleep(86400)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
|
try:
|
||||||
|
for session in pkg.openai.session.sessions:
|
||||||
|
pkg.openai.session.sessions[session].persistence()
|
||||||
|
except Exception as e:
|
||||||
|
if not isinstance(e, KeyboardInterrupt):
|
||||||
|
raise e
|
||||||
print("程序退出")
|
print("程序退出")
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ class DatabaseManager:
|
|||||||
|
|
||||||
def heartbeat(self):
|
def heartbeat(self):
|
||||||
while True:
|
while True:
|
||||||
self.conn.ping(reconnect=True)
|
|
||||||
time.sleep(30)
|
time.sleep(30)
|
||||||
|
self.conn.ping(reconnect=True)
|
||||||
|
|
||||||
def reconnect(self):
|
def reconnect(self):
|
||||||
self.conn = pymysql.connect(host=self.host, port=self.port, user=self.user, password=self.password,
|
self.conn = pymysql.connect(host=self.host, port=self.port, user=self.user, password=self.password,
|
||||||
|
|||||||
Reference in New Issue
Block a user