Closed txase closed 8 years ago
Thoroughly reported, thanks :)
The intent was "I had a problem, do whatever needs doing"; in the case of a minimum resource count this operates as intended, but in this case ensureMinimum should be checking whether there are pending requests in addition to the count, or more likely, don't "reuse" ensureMinimum for this scenario, instead providing something with a more correct semantic meaning.
Published a new version
Looks good! I'll try it out over the next day or so, and I'll follow up if there are any issues. Otherwise, thanks a bunch!
Scenario:
bailAfter: Infinity
min: 0
max: 1
Example log:
When acquisition fails, we get to: https://github.com/myndzi/pool2/blob/310728e528fc96520cf6e2f57129888d7eb0ea6d/lib/pool.js#L456-L472
Because the pool is not live yet and
bailAfter
is set toInfinity
, we fall through to the following line:We then wait the backoff period only to end up calling
_ensureMinimum
, which returns immediately becausemin
is 0.What needs to happen is one of the following: