Merge branch 'dev' of https://github.com/MoFox-Studio/MoFox-Core into dev
This commit is contained in:
@@ -121,7 +121,7 @@ class StatisticOutputTask(AsyncTask):
|
||||
|
||||
def __init__(self, record_file_path: str = "mofox_bot_statistics.html"):
|
||||
# 延迟300秒启动,运行间隔300秒
|
||||
super().__init__(task_name="Statistics Data Output Task", wait_before_start=0, run_interval=300)
|
||||
super().__init__(task_name="Statistics Data Output Task", wait_before_start=600, run_interval=900)
|
||||
|
||||
self.name_mapping: dict[str, tuple[str, float]] = {}
|
||||
"""
|
||||
|
||||
@@ -114,6 +114,9 @@ def _build_sqlite_config(config) -> tuple[str, dict]:
|
||||
"check_same_thread": False,
|
||||
"timeout": 60,
|
||||
},
|
||||
# ⚠️ 禁用 SQLAlchemy 查询编译缓存以阻断可能的 tuple 膨胀
|
||||
# 观察到长时间运行后 tuple 数量飙升,先通过关闭缓存止血
|
||||
"query_cache_size": 0,
|
||||
}
|
||||
|
||||
logger.debug(f"SQLite配置: {db_path}")
|
||||
@@ -162,6 +165,8 @@ def _build_postgresql_config(config) -> tuple[str, dict]:
|
||||
"pool_timeout": config.connection_timeout,
|
||||
"pool_recycle": 3600,
|
||||
"pool_pre_ping": True,
|
||||
# ⚠️ 禁用 SQLAlchemy 查询编译缓存以阻断可能的 tuple 膨胀
|
||||
"query_cache_size": 0,
|
||||
}
|
||||
|
||||
if connect_args:
|
||||
|
||||
@@ -112,16 +112,13 @@ async def find_messages(
|
||||
if limit <= 0:
|
||||
capped_limit = SAFE_FETCH_LIMIT
|
||||
logger.warning(
|
||||
"find_messages 未指定 limit,自动限制为 %s 行以避免内存占用过高",
|
||||
capped_limit,
|
||||
f"find_messages 未指定 limit,自动限制为 {capped_limit} 行以避免内存占用过高",
|
||||
)
|
||||
else:
|
||||
capped_limit = max(1, int(limit))
|
||||
if capped_limit > SAFE_FETCH_LIMIT:
|
||||
logger.warning(
|
||||
"find_messages 请求的 limit=%s 超过安全上限,已限制为 %s",
|
||||
limit,
|
||||
SAFE_FETCH_LIMIT,
|
||||
f"find_messages 请求的 limit={limit} 超过安全上限,已限制为 {SAFE_FETCH_LIMIT}",
|
||||
)
|
||||
capped_limit = SAFE_FETCH_LIMIT
|
||||
|
||||
|
||||
Reference in New Issue
Block a user