fix:统计和person_info现已成为异步,巨爽

This commit is contained in:
SengokuCola
2025-06-22 17:13:43 +08:00
parent ca47144fd9
commit ce50f59c0a
6 changed files with 227 additions and 23 deletions

View File

@@ -69,4 +69,14 @@ _DB_FILE = os.path.join(_DB_DIR, "MaiBot.db")
os.makedirs(_DB_DIR, exist_ok=True)
# 全局 Peewee SQLite 数据库访问点
db = SqliteDatabase(_DB_FILE)
db = SqliteDatabase(
_DB_FILE,
pragmas={
'journal_mode': 'wal', # WAL模式提高并发性能
'cache_size': -64 * 1000, # 64MB缓存
'foreign_keys': 1,
'ignore_check_constraints': 0,
'synchronous': 0, # 异步写入提高性能
'busy_timeout': 1000, # 1秒超时而不是3秒
}
)