perf: Add celery worker count config

pull/15535/head
wangruidong 2025-06-09 10:41:21 +08:00 committed by 老广
parent caf23f5b05
commit d179ce1cd4
6 changed files with 9 additions and 4 deletions

View File

@ -25,3 +25,4 @@ BASE_DIR = os.path.dirname(settings.BASE_DIR)
LOG_DIR = os.path.join(BASE_DIR, 'data', 'logs') LOG_DIR = os.path.join(BASE_DIR, 'data', 'logs')
APPS_DIR = os.path.join(BASE_DIR, 'apps') APPS_DIR = os.path.join(BASE_DIR, 'apps')
TMP_DIR = os.path.join(BASE_DIR, 'tmp') TMP_DIR = os.path.join(BASE_DIR, 'tmp')
CELERY_WORKER_COUNT = CONFIG.CELERY_WORKER_COUNT or 10

View File

@ -4,10 +4,10 @@ from ..hands import *
class CeleryBaseService(BaseService): class CeleryBaseService(BaseService):
def __init__(self, queue, num=10, **kwargs): def __init__(self, queue, **kwargs):
super().__init__(**kwargs) super().__init__(**kwargs)
self.queue = queue self.queue = queue
self.num = num self.num = CELERY_WORKER_COUNT
@property @property
def cmd(self): def cmd(self):

View File

@ -240,5 +240,6 @@
"VerificationFailed": "Verification failed", "VerificationFailed": "Verification failed",
"BatchCommands": "Batch commands", "BatchCommands": "Batch commands",
"SendCommandPlaceholder": "Input command here..., Enter for new line, Ctrl+Enter to send", "SendCommandPlaceholder": "Input command here..., Enter for new line, Ctrl+Enter to send",
"SelectCommand": "Please select the command to execute." "SelectCommand": "Please select the command to execute.",
"ConnectSessionCount": "{{ count }} sessions connected"
} }

View File

@ -238,5 +238,6 @@
"Send": "发送", "Send": "发送",
"BatchCommands": "批量命令", "BatchCommands": "批量命令",
"SendCommandPlaceholder": "输入命令回车换行Ctrl+Enter 执行命令", "SendCommandPlaceholder": "输入命令回车换行Ctrl+Enter 执行命令",
"SelectCommand": "请选择要执行的命令" "SelectCommand": "请选择要执行的命令",
"ConnectSessionCount": "{{ count }} 个会话已连接"
} }

View File

@ -623,6 +623,7 @@ class Config(dict):
'HTTP_BIND_HOST': '0.0.0.0', 'HTTP_BIND_HOST': '0.0.0.0',
'HTTP_LISTEN_PORT': 8080, 'HTTP_LISTEN_PORT': 8080,
'WS_LISTEN_PORT': 8070, 'WS_LISTEN_PORT': 8070,
'CELERY_WORKER_COUNT': 10,
'SYSLOG_ADDR': '', # '192.168.0.1:514' 'SYSLOG_ADDR': '', # '192.168.0.1:514'
'SYSLOG_FACILITY': 'user', 'SYSLOG_FACILITY': 'user',

View File

@ -124,6 +124,7 @@ ASSET_PERMISSION_DEFAULT_EXPIRED_DAYS = CONFIG.ASSET_PERMISSION_DEFAULT_EXPIRED_
USER_GUIDE_URL = CONFIG.USER_GUIDE_URL USER_GUIDE_URL = CONFIG.USER_GUIDE_URL
HTTP_LISTEN_PORT = CONFIG.HTTP_LISTEN_PORT HTTP_LISTEN_PORT = CONFIG.HTTP_LISTEN_PORT
WS_LISTEN_PORT = CONFIG.WS_LISTEN_PORT WS_LISTEN_PORT = CONFIG.WS_LISTEN_PORT
CELERY_WORKER_COUNT = CONFIG.CELERY_WORKER_COUNT
LOGIN_LOG_KEEP_DAYS = CONFIG.LOGIN_LOG_KEEP_DAYS LOGIN_LOG_KEEP_DAYS = CONFIG.LOGIN_LOG_KEEP_DAYS
TASK_LOG_KEEP_DAYS = CONFIG.TASK_LOG_KEEP_DAYS TASK_LOG_KEEP_DAYS = CONFIG.TASK_LOG_KEEP_DAYS
OPERATE_LOG_KEEP_DAYS = CONFIG.OPERATE_LOG_KEEP_DAYS OPERATE_LOG_KEEP_DAYS = CONFIG.OPERATE_LOG_KEEP_DAYS