mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Only log '[num] workers' message when it changes.
Otherwise when debug logging is on, the message prints every second even with no system activity.
This commit is contained in:
parent
0d86a9094d
commit
09357ed3c4
@ -473,6 +473,8 @@ class Arbiter(object):
|
|||||||
Maintain the number of workers by spawning or killing
|
Maintain the number of workers by spawning or killing
|
||||||
as required.
|
as required.
|
||||||
"""
|
"""
|
||||||
|
orig_num_workers = self.num_workers
|
||||||
|
|
||||||
if len(self.WORKERS.keys()) < self.num_workers:
|
if len(self.WORKERS.keys()) < self.num_workers:
|
||||||
self.spawn_workers()
|
self.spawn_workers()
|
||||||
|
|
||||||
@ -482,10 +484,11 @@ class Arbiter(object):
|
|||||||
(pid, _) = workers.pop(0)
|
(pid, _) = workers.pop(0)
|
||||||
self.kill_worker(pid, signal.SIGTERM)
|
self.kill_worker(pid, signal.SIGTERM)
|
||||||
|
|
||||||
self.log.debug("{0} workers".format(len(workers)),
|
if self.num_workers != orig_num_workers:
|
||||||
extra={"metric": "gunicorn.workers",
|
self.log.debug("{0} workers".format(len(workers)),
|
||||||
"value": len(workers),
|
extra={"metric": "gunicorn.workers",
|
||||||
"mtype": "gauge"})
|
"value": len(workers),
|
||||||
|
"mtype": "gauge"})
|
||||||
|
|
||||||
def spawn_worker(self):
|
def spawn_worker(self):
|
||||||
self.worker_age += 1
|
self.worker_age += 1
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user