mongodb/mongo-ruby-driver — pull request #224 by nelhage (2013-07-12 18:56:24+00:00)
Title: Mongo::Pool: Always try at least once to get a socket.

On heavily-loaded machines with a small timeout, it is actually
possible for the timeout to expire before even a single pass through
the checkout loop. This results in throwing ConnectionTimeoutError's,
even though nothing directly mongo-related is actually timing out or
going wrong.

Always pass through the loop at least once before timing out, so that
we are guaranteed to find a socket if there is one immediately
available.

This is the same code as PR #149, which appears to have been merged into the 1.8.2 release branch, but (accidentally?) dropped elsewhere.