From 324f836fdd6f014e00755bdc32546788250fe0ce Mon Sep 17 00:00:00 2001 From: liqiang-fit2cloud Date: Tue, 11 Nov 2025 18:13:21 +0800 Subject: [PATCH] refactor: never restart core worker if worker=1. --- apps/common/management/commands/services/services/gunicorn.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/common/management/commands/services/services/gunicorn.py b/apps/common/management/commands/services/services/gunicorn.py index 8225ee2ff..4a7233920 100644 --- a/apps/common/management/commands/services/services/gunicorn.py +++ b/apps/common/management/commands/services/services/gunicorn.py @@ -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',