feat(main): 移除数据库连接初始化方法,简化异步初始化流程
This commit is contained in:
9
bot.py
9
bot.py
@@ -555,11 +555,6 @@ class MaiBotMain:
|
||||
except Exception as e:
|
||||
logger.warning(f"时区设置失败: {e}")
|
||||
|
||||
async def initialize_database(self):
|
||||
"""初始化数据库连接"""
|
||||
async with DatabaseManager():
|
||||
pass
|
||||
|
||||
async def initialize_database_async(self):
|
||||
"""异步初始化数据库表结构"""
|
||||
logger.info("正在初始化数据库表结构...")
|
||||
@@ -593,9 +588,7 @@ class MaiBotMain:
|
||||
|
||||
async def run_async_init(self, main_system):
|
||||
"""执行异步初始化步骤"""
|
||||
# 初始化数据库连接
|
||||
await self.initialize_database()
|
||||
|
||||
|
||||
# 初始化数据库表结构
|
||||
await self.initialize_database_async()
|
||||
|
||||
|
||||
@@ -198,11 +198,6 @@ class SingleStreamContextManager:
|
||||
failed_ids.append(str(message_id)[:8])
|
||||
logger.warning(f"标记消息已读失败 {message_id}: {e}")
|
||||
|
||||
if marked_count > 0:
|
||||
logger.info(f"✅ [批量标记] stream={self.stream_id[:8]}, 成功标记 {marked_count}/{len(message_ids)} 条消息为已读")
|
||||
if failed_ids:
|
||||
logger.warning(f"⚠️ [批量标记] stream={self.stream_id[:8]}, {len(failed_ids)} 条消息标记失败: {failed_ids[:5]}")
|
||||
|
||||
return marked_count > 0
|
||||
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user