完善数据库调用
This commit is contained in:
BIN
backend/app/core/database/__pycache__/mongodb.cpython-312.pyc
Normal file
BIN
backend/app/core/database/__pycache__/mongodb.cpython-312.pyc
Normal file
Binary file not shown.
Binary file not shown.
BIN
backend/app/core/database/__pycache__/redis_db.cpython-312.pyc
Normal file
BIN
backend/app/core/database/__pycache__/redis_db.cpython-312.pyc
Normal file
Binary file not shown.
@@ -37,7 +37,7 @@ class MySQLDB:
|
||||
def __init__(self):
|
||||
# 异步引擎 (用于 FastAPI 异步操作)
|
||||
self.async_engine = create_async_engine(
|
||||
settings.mysql_url,
|
||||
settings.async_mysql_url,
|
||||
echo=settings.DEBUG, # SQL 日志
|
||||
pool_pre_ping=True, # 连接前检测
|
||||
pool_size=10,
|
||||
@@ -55,7 +55,7 @@ class MySQLDB:
|
||||
|
||||
# 同步引擎 (用于 Celery 同步任务)
|
||||
self.sync_engine = create_engine(
|
||||
settings.mysql_url.replace("mysql+pymysql", "mysql"),
|
||||
settings.mysql_url,
|
||||
echo=settings.DEBUG,
|
||||
pool_pre_ping=True,
|
||||
pool_size=5,
|
||||
|
||||
@@ -6,7 +6,7 @@ Redis 数据库连接管理模块
|
||||
import json
|
||||
import logging
|
||||
from datetime import timedelta
|
||||
from typing import Any, Optional
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
import redis.asyncio as redis
|
||||
|
||||
|
||||
Reference in New Issue
Block a user