fix: update max-requests configuration to be dynamic based on worker count
Some checks failed
sync2gitee / repo-sync (push) Has been cancelled

This commit is contained in:
CaptainB 2025-11-19 10:07:10 +08:00
parent 435491d9e6
commit 1108a8536e
2 changed files with 4 additions and 2 deletions

View File

@ -16,13 +16,14 @@ class GunicornService(BaseService):
log_format = '%(h)s %(t)s %(L)ss "%(r)s" %(s)s %(b)s '
bind = f'{HTTP_HOST}:{HTTP_PORT}'
max_requests = 10240 if int(self.worker) > 1 else 0
cmd = [
'gunicorn', 'smartdoc.wsgi:application',
'-b', bind,
'-k', 'gthread',
'--threads', '200',
'-w', str(self.worker),
'--max-requests', '10240',
'--max-requests', str(max_requests),
'--max-requests-jitter', '2048',
'--access-logformat', log_format,
'--access-logfile', '-'

View File

@ -25,13 +25,14 @@ class GunicornLocalModelService(BaseService):
log_format = '%(h)s %(t)s %(L)ss "%(r)s" %(s)s %(b)s '
bind = f'{CONFIG.get("LOCAL_MODEL_HOST")}:{CONFIG.get("LOCAL_MODEL_PORT")}'
worker = CONFIG.get("LOCAL_MODEL_HOST_WORKER", 1)
max_requests = 10240 if int(worker) > 1 else 0
cmd = [
'gunicorn', 'smartdoc.wsgi:application',
'-b', bind,
'-k', 'gthread',
'--threads', '200',
'-w', str(worker),
'--max-requests', '10240',
'--max-requests', str(max_requests),
'--max-requests-jitter', '2048',
'--access-logformat', log_format,
'--access-logfile', '-'