coopernurse/node-pool — pull request #50 by pooyasencha (2012-10-05 01:48:24+00:00)
Title: Fix to empty waiting clients queues in case of an error

If there's an error with creation of a connection we should keep dispensing the waiting clients as long as they exist, otherwise we will only remove one waitingClient from the queue and never go back to other waiting ones.

I created a copy of the "handle creation error" test to show this behaviour. If create doesn't return immediately and it fails although count stays 0, clients will be put on waiting queue and never picked up. That's why on the error callback I called dispense again to check for other waiting requests.