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

Method worker_remove

gunicorn/ctl/handlers.py:250–276  ·  view source on GitHub ↗

Decrease worker count. Args: count: Number of workers to remove (default 1) Returns: Dictionary with removed count and new total

(self, count: int = 1)

Source from the content-addressed store, hash-verified

248 }
249
250 def worker_remove(self, count: int = 1) -> dict:
251 """
252 Decrease worker count.
253
254 Args:
255 count: Number of workers to remove (default 1)
256
257 Returns:
258 Dictionary with removed count and new total
259 """
260 count = max(1, int(count))
261 old_count = self.arbiter.num_workers
262
263 # Don't go below 1 worker
264 new_count = max(1, old_count - count)
265 actual_removed = old_count - new_count
266
267 self.arbiter.num_workers = new_count
268
269 # Wake up the arbiter to kill excess workers
270 self.arbiter.wakeup()
271
272 return {
273 "removed": actual_removed,
274 "previous": old_count,
275 "total": new_count,
276 }
277
278 def worker_kill(self, pid: int) -> dict:
279 """

Calls 1

wakeupMethod · 0.45