Allow `CapacityLimiter` to have `total_tokens=0`
Sometimes, there are use-cases where you want to entirely pause processing of some tasks, and then later scale back up. CapacityLimiter is basically perfect for this kind of thing, except that it currently raises an error if you pass total_tokens=0:
https://github.com/python-trio/trio/blob/d988edd368f094855bd1c36442302113f45f2a1c/src/trio/_sync.py#L254-L255
It's already possible to get the desired effect just by deliberately "leaking" one of the tokens, but it would be much nicer to simply allow zero as the intended capacity, by editing the numbers in the setter above.
Might need to make sure this is tested too, since zero is rather susceptible to edge cases. Looks safe though.
@Zac-HD , I'm interested, could you kindly assign me this task
Hi @kachida any progress? If not, would you mind un-assigning yourself?
You should be able to re-assign yourself whenever you have the time and want to fix this issue.