lib/stillwater/connection_pool.rb in stillwater-0.0.1 vs lib/stillwater/connection_pool.rb in stillwater-0.0.2
- old
+ new
@@ -1,7 +1,5 @@
-require 'active_support/core_ext/array'
-
module Stillwater
class ConnectionNotAvailable < StandardError ; end
class ConnectionPool
attr_accessor :reactivate_timeout, :retry_count
@@ -44,10 +42,10 @@
ensure
checkin conn
end
def checkout
- connection_info = available.sample
+ connection_info = available.respond_to?(:sample) ? available.sample : available.choice
raise ConnectionNotAvailable if connection_info.nil?
connection_info[:state] = :in_use
connection_info[:connection]
end