From a68618c824216018a6560af8db89493c574328a0 Mon Sep 17 00:00:00 2001 From: benoitc Date: Mon, 18 Jun 2012 11:02:30 +0200 Subject: [PATCH] breaking change: take the control on graceful reload back We really shouldn't allow the people to override the way we spawn the new workers on reload. Graceful is about launching new worker and kill olders after the graceful time. --- gunicorn/arbiter.py | 6 +++++- gunicorn/config.py | 3 +-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/gunicorn/arbiter.py b/gunicorn/arbiter.py index 47f9888e..802abda8 100644 --- a/gunicorn/arbiter.py +++ b/gunicorn/arbiter.py @@ -359,7 +359,7 @@ class Arbiter(object): self.LISTENER = create_socket(self.cfg, self.log) self.log.info("Listening at: %s", self.LISTENER) - # spawn new workers with new app & conf + # do some actions on reload self.cfg.on_reload(self) # unlink pidfile @@ -374,6 +374,10 @@ class Arbiter(object): # set new proc_name util._setproctitle("master [%s]" % self.proc_name) + # spawn new workers + for i in range(self.cfg.workers): + self.spawn_worker() + # manage workers self.manage_workers() diff --git a/gunicorn/config.py b/gunicorn/config.py index 58848215..df4d8076 100644 --- a/gunicorn/config.py +++ b/gunicorn/config.py @@ -867,8 +867,7 @@ class OnReload(Setting): validator = validate_callable(1) type = "callable" def on_reload(server): - for i in range(server.app.cfg.workers): - server.spawn_worker() + pass default = staticmethod(on_reload) desc = """\ Called to recycle workers during a reload via SIGHUP.