MCPcopy
hub / github.com/benoitc/gunicorn / murder_workers

Method murder_workers

gunicorn/arbiter.py:576–595  ·  view source on GitHub ↗

\ Kill unused/idle workers

(self)

Source from the content-addressed store, hash-verified

574 time.sleep(0.1)
575
576 def murder_workers(self):
577 """\
578 Kill unused/idle workers
579 """
580 if not self.timeout:
581 return
582 workers = list(self.WORKERS.items())
583 for (pid, worker) in workers:
584 try:
585 if time.monotonic() - worker.tmp.last_update() <= self.timeout:
586 continue
587 except (OSError, ValueError):
588 continue
589
590 if not worker.aborted:
591 self.log.critical("WORKER TIMEOUT (pid:%s)", pid)
592 worker.aborted = True
593 self.kill_worker(pid, signal.SIGABRT)
594 else:
595 self.kill_worker(pid, signal.SIGKILL)
596
597 def reap_workers(self):
598 """\

Calls 4

kill_workerMethod · 0.95
itemsMethod · 0.80
last_updateMethod · 0.80
criticalMethod · 0.45