移除线程池

This commit is contained in:
毛鹏
2025-12-04 18:41:36 +08:00
parent 268e94efd8
commit 886cc7689f
4 changed files with 6 additions and 16 deletions

Binary file not shown.

View File

@@ -32,6 +32,7 @@ class JwtQueryParamsAuthentication(BaseAuthentication):
except jwt.InvalidTokenError:
raise AuthenticationFailed({'code': 303, 'msg': 'token 非法,请使用有效的 token', 'data': None})
except Exception as e:
raise AuthenticationFailed({'code': 304, 'msg': f'token 验证失败: {str(e)}', 'data': None})
return payload, token

View File

@@ -115,7 +115,7 @@ CHANNEL_LAYERS = {
if not IS_SQLITE:
DATABASES = {
'default': {
'ENGINE': 'dj_db_conn_pool.backends.mysql',
'ENGINE': 'django.db.backends.mysql',
'NAME': MYSQL_DB_NAME,
'USER': MYSQL_USER,
'PASSWORD': MYSQL_PASSWORD,
@@ -130,17 +130,6 @@ if not IS_SQLITE:
'isolation_level': 'READ COMMITTED',
'autocommit': True,
},
'POOL_OPTIONS': {
'POOL_SIZE': 20, # 增加连接池大小
'MAX_OVERFLOW': 30, # 增加最大溢出
'RECYCLE': 3600, # 延长回收时间到1小时
'TIMEOUT': 30, # 增加获取连接超时到30秒
'PRE_PING': True, # 保持开启
'ECHO': False, # 关闭SQL日志
'MAX_POOL_SIZE': 50, # 增加最大池大小限制
'POOL_RECYCLE': 3600, # 明确指定池回收
},
'CONN_MAX_AGE': 3600, # 改为3600秒与RECYCLE一致
}
}
else:

View File

@@ -1,21 +1,21 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Project: 芒果测试平台
# @Description: Uvicorn启动脚本
# @Time : 2025/12/3
# @Author : AI助手
# @Author :
import uvicorn
import os
if __name__ == "__main__":
# 获取环境变量
# os.environ["DJANGO_ENV"] = "dev"
host = os.environ.get("UVICORN_HOST", "0.0.0.0")
port = int(os.environ.get("UVICORN_PORT", 8000))
workers = int(os.environ.get("UVICORN_WORKERS", 2))
log_level = os.environ.get("UVICORN_LOG_LEVEL", "info")
access_log = os.environ.get("UVICORN_ACCESS_LOG", "true").lower() == "true"
# 启动Uvicorn服务器
uvicorn.run(
"src.asgi:application",
@@ -24,4 +24,4 @@ if __name__ == "__main__":
workers=workers,
log_level=log_level,
access_log=access_log
)
)