Skip to content

Commit

Permalink
made ConnectionPool#checkout more robust by trying to loot dead threa…
Browse files Browse the repository at this point in the history
…ds when pool is empty
  • Loading branch information
Aliaksey Kandratsenka committed Oct 4, 2008
1 parent e712798 commit 474d5ea
Showing 1 changed file with 5 additions and 1 deletion.
Expand Up @@ -143,7 +143,11 @@ def checkout
if @queue.wait(@timeout)
next
else
raise ConnectionTimeoutError, "could not obtain a database connection within #{@timeout} seconds. The pool size is currently #{@size}, perhaps you need to increase it?"
# try looting dead threads
clear_stale_cached_connections!
if @size == @checked_out.size
raise ConnectionTimeoutError, "could not obtain a database connection within #{@timeout} seconds. The pool size is currently #{@size}, perhaps you need to increase it?"
end
end
end
end
Expand Down

0 comments on commit 474d5ea

Please sign in to comment.