mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 09:20:22 +08:00
perf: 优化 Provider 预加载和 bcrypt 密码验证性能
- 使用 selectinload 预加载 endpoints 避免 N+1 查询 - 将 bcrypt 密码验证移至线程池执行,避免阻塞事件循环
This commit is contained in:
@@ -266,7 +266,8 @@ class AuthService:
|
||||
logger.warning(f"登录失败 - 该用户使用 LDAP 认证: {email}")
|
||||
return None
|
||||
|
||||
if not user.verify_password(password):
|
||||
# 在线程池中执行 bcrypt 密码验证,避免阻塞事件循环
|
||||
if not await run_in_threadpool(user.verify_password, password):
|
||||
logger.warning(f"登录失败 - 密码错误: {email}")
|
||||
return None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user