fix(api): 修复机器人消息统计计数器逻辑
chore(logging): 移除 message_manager 各模块多余的启动日志 - 修复了 `get_bot_message_stats_by_chat` 接口中错误地将计数器重置为1而不是递增的问题。 - 清理了 `message_manager` 及其子模块中重复或不必要的启动日志,以减少日志冗余。
This commit is contained in:
@@ -151,7 +151,7 @@ async def get_bot_message_stats_by_chat(
|
|||||||
chat_id = msg.get("chat_id", "unknown")
|
chat_id = msg.get("chat_id", "unknown")
|
||||||
if chat_id not in stats:
|
if chat_id not in stats:
|
||||||
stats[chat_id] = 0
|
stats[chat_id] = 0
|
||||||
stats[chat_id] = 1
|
stats[chat_id] += 1
|
||||||
|
|
||||||
if format:
|
if format:
|
||||||
chat_manager = get_chat_manager()
|
chat_manager = get_chat_manager()
|
||||||
|
|||||||
@@ -110,7 +110,6 @@ class AdaptiveStreamManager:
|
|||||||
self.is_running = True
|
self.is_running = True
|
||||||
self.monitor_task = asyncio.create_task(self._system_monitor_loop(), name="system_monitor")
|
self.monitor_task = asyncio.create_task(self._system_monitor_loop(), name="system_monitor")
|
||||||
self.adjustment_task = asyncio.create_task(self._adjustment_loop(), name="limit_adjustment")
|
self.adjustment_task = asyncio.create_task(self._adjustment_loop(), name="limit_adjustment")
|
||||||
logger.info("自适应流管理器已启动")
|
|
||||||
|
|
||||||
async def stop(self):
|
async def stop(self):
|
||||||
"""停止自适应管理器"""
|
"""停止自适应管理器"""
|
||||||
|
|||||||
@@ -72,7 +72,6 @@ class BatchDatabaseWriter:
|
|||||||
|
|
||||||
self.is_running = True
|
self.is_running = True
|
||||||
self.writer_task = asyncio.create_task(self._batch_writer_loop(), name="batch_database_writer")
|
self.writer_task = asyncio.create_task(self._batch_writer_loop(), name="batch_database_writer")
|
||||||
logger.info("批量数据库写入器已启动")
|
|
||||||
|
|
||||||
async def stop(self):
|
async def stop(self):
|
||||||
"""停止批量写入器"""
|
"""停止批量写入器"""
|
||||||
|
|||||||
@@ -59,7 +59,6 @@ class StreamLoopManager:
|
|||||||
return
|
return
|
||||||
|
|
||||||
self.is_running = True
|
self.is_running = True
|
||||||
logger.info("流循环管理器已启动")
|
|
||||||
|
|
||||||
async def stop(self) -> None:
|
async def stop(self) -> None:
|
||||||
"""停止流循环管理器"""
|
"""停止流循环管理器"""
|
||||||
|
|||||||
@@ -60,7 +60,6 @@ class MessageManager:
|
|||||||
try:
|
try:
|
||||||
from src.chat.message_manager.batch_database_writer import init_batch_writer
|
from src.chat.message_manager.batch_database_writer import init_batch_writer
|
||||||
await init_batch_writer()
|
await init_batch_writer()
|
||||||
logger.info("📦 批量数据库写入器已启动")
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"启动批量数据库写入器失败: {e}")
|
logger.error(f"启动批量数据库写入器失败: {e}")
|
||||||
|
|
||||||
@@ -68,7 +67,6 @@ class MessageManager:
|
|||||||
try:
|
try:
|
||||||
from src.chat.message_manager.stream_cache_manager import init_stream_cache_manager
|
from src.chat.message_manager.stream_cache_manager import init_stream_cache_manager
|
||||||
await init_stream_cache_manager()
|
await init_stream_cache_manager()
|
||||||
logger.info("🗄️ 流缓存管理器已启动")
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"启动流缓存管理器失败: {e}")
|
logger.error(f"启动流缓存管理器失败: {e}")
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,6 @@ class TieredStreamCache:
|
|||||||
|
|
||||||
self.is_running = True
|
self.is_running = True
|
||||||
self.cleanup_task = asyncio.create_task(self._cleanup_loop(), name="stream_cache_cleanup")
|
self.cleanup_task = asyncio.create_task(self._cleanup_loop(), name="stream_cache_cleanup")
|
||||||
logger.info("分层流缓存管理器已启动")
|
|
||||||
|
|
||||||
async def stop(self):
|
async def stop(self):
|
||||||
"""停止缓存管理器"""
|
"""停止缓存管理器"""
|
||||||
|
|||||||
Reference in New Issue
Block a user