refactor: never restart core worker if worker=1.

This commit is contained in:
liqiang-fit2cloud 2025-11-11 18:13:21 +08:00 committed by CaptainB
parent 923f3f1f5e
commit 2050adfdc5

View File

@ -18,13 +18,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', 'maxkb.wsgi:application',
'-b', bind,
'-k', 'gthread',
'--threads', '200',
'-w', str(self.worker),
'--max-requests', '10240',
'--max-requests', str(max_requests),
'--max-requests-jitter', '2048',
'--timeout', '0',
'--graceful-timeout', '0',