Skip to content

Commit

Permalink
Merge pull request #105 from rage-rb/rake-ar-patch
Browse files Browse the repository at this point in the history
Correctly patch AR pool in Rails mode
  • Loading branch information
rsamoilov authored Sep 17, 2024
2 parents 6bf8859 + f0915aa commit 2fe97c9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/rage-rb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def self.patch_active_record_connection_pool
patch = proc do
is_connected = ActiveRecord::Base.connection_pool rescue false
if is_connected
puts "INFO: Patching ActiveRecord::ConnectionPool"
Iodine.on_state(:pre_start) { puts "INFO: Patching ActiveRecord::ConnectionPool" }
Iodine.on_state(:on_start) do
ActiveRecord::Base.connection_handler.connection_pool_list(:all).each do |pool|
pool.extend(Rage::Ext::ActiveRecord::ConnectionPool)
Expand Down
2 changes: 1 addition & 1 deletion lib/rage/ext/setup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,6 @@ def connection_cache_key(_)
end

# patch `ActiveRecord::ConnectionPool`
if defined?(ActiveRecord) && !defined?(Rake) && Rage.config.internal.patch_ar_pool?
if defined?(ActiveRecord) && Rage.config.internal.patch_ar_pool?
Rage.patch_active_record_connection_pool
end

0 comments on commit 2fe97c9

Please sign in to comment.