• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

cjrh / deadpool / 46408253838
89%

Build:
DEFAULT BRANCH: main
Ran 30 Nov 2026 11:21AM UTC
Jobs 1
Files 13
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

30 Nov 2026 11:19AM UTC coverage: 88.568% (+0.4%) from 88.129%
46408253838

push

github

web-flow
Add idle_timeout: stop workers idle longer than it, down to min_workers (#453)

Adds `idle_timeout` to `Deadpool`: a worker that has been idle longer
than it is stopped while the pool is above `min_workers`. Off by
default, following the review of #452.

**Behaviour, with `idle_timeout` set:**

- A worker that is idle for `idle_timeout` seconds stops while the pool
has more than `min_workers` workers, one at a time. A worker that has
run a task goes before one that has not.
- Tasks go to the most recently used worker, so that under light load
the others can go idle. A new worker waits at the back, so a task gets a
warm one if there is one. First in, first out stays the default.
- A worker whose task ends no longer stops at once when the pool is
above its minimum.
- `min_workers` is read at each check, so a change is seen. It must be
between 1 and `max_workers` when the option is used; without
`min_workers` the option has no effect and starts no thread.
- The age, the minimum and the removal are one step under
`_checkout_lock`, so a task and the timer cannot both claim a worker,
and a task that counted an idle worker is not left without it.
- `get_statistics()` gains `worker_processes_stopped_idle` and
`idle_sweep_errors`, only for such a pool.

**With the default, nothing changes:** no thread, the same queue, the
same statistics dict.

**If the check itself fails,** it is logged and counted and the timer
carries on. A worker that cannot be told to stop is killed.

**Tests** (`tests/test_idle_timeout.py`): the stack's order; a quiet
pool reaching its minimum; a busy worker counting towards it and
surviving expiry; a task and the timer not claiming the same worker; a
stranded task, as in #452; the default starting no timer; one worker
stopping at a time; growing back and shrinking again; refused values; a
failing check and a worker that cannot be told to stop. Each behaviour
has a mutant that a test fails, and the new branches are covered.

The full sui... (continued)

809 of 999 branches covered (80.98%)

Branch coverage included in aggregate %.

103 of 104 new or added lines in 1 file covered. (99.04%)

2747 of 3016 relevant lines covered (91.08%)

5.45 hits per line

Uncovered Changes

Lines Coverage ∆ File
1
95.36
1.18% deadpool/_pool.py
Jobs
ID Job ID Ran Files Coverage
1 46408253838.1 30 Nov 2026 11:22AM UTC 13
88.57
GitHub Action Run
Source Files on build 46408253838
  • Tree
  • List 13
  • Changed 1
  • Source Changed 0
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • 2c6ff5db on github
  • Prev Build on main (#46365171365)
  • Next Build on main (#46408621737)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc