Skip to content

Commit

Permalink
Support ActiveRecord 5.0 without overhead under 4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
YOSHIDA Hiroki committed Oct 23, 2016
1 parent 6de041a commit ff5efc5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/em-synchrony/activerecord.rb
Expand Up @@ -9,7 +9,11 @@ module ConnectionAdapters
class ConnectionPool
def connection
_fibered_mutex.synchronize do
@reserved_connections[current_connection_id] ||= checkout
if Gem::Version.new(::ActiveRecord::VERSION::STRING) >= Gem::Version.new('5.0')
@thread_cached_conns[connection_cache_key(Thread.current)] ||= checkout
else
@reserved_connections[current_connection_id] ||= checkout
end
end
end

Expand Down

0 comments on commit ff5efc5

Please sign in to comment.