Comment 0 for bug 1095077

Revision history for this message
Nick Groenen (zoni) wrote :

While playing around with Rocket, I noticed my threadpool wasn't growing
when I had max_threads set to 0, which should indicate there's no upper
boundary on the maximum number of threads it may create.

I tracked this down to a peace of code in grow() which ensures it never
grows beyond it's max_threads, but didn't take into consideration what
would happen with max_threads set to 0.

I fixed this here:
http://bazaar.launchpad.net/~zoni/rocket/rocket/revision/196#rocket/threadpool.py

(I added a line of comment as well because the first time I saw that line
of code, it wasn't clear to me what it's purpose was.)

I did look at the unit tests, but couldn't see a quick way to test for this
use case, so I'll leave that up to another taker. :)

Setting max_threads to 0 there without this commit causes 3 test failures
though, after my commit, only 1 test failure remains.