octopus
octopus copied to clipboard
[Experimental] Minimum support for Rails 6.1
This PR is only replacing failing methods (only the detected ones) with new classes and methods from Rails 6.1.
This PR is only replacing failing methods (only the detected ones) with new classes and methods from Rails 6.1.
But I use passenger have some errors. I think the passenger have call ActiveRecord::Base.clear_all_connections!
undefined method `clear' for nil:NilClass (NoMethodError)
/usr/local/rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:832:in `block in with_new_connections_blocked'
/usr/local/rvm/rubies/ruby-2.7.8/lib/ruby/2.7.0/monitor.rb:202:in `synchronize'
/usr/local/rvm/rubies/ruby-2.7.8/lib/ruby/2.7.0/monitor.rb:202:in `mon_synchronize'
/usr/local/rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:828:in `ensure in with_new_connections_blocked'
/usr/local/rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:845:in `with_new_connections_blocked'
/usr/local/rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:747:in `with_exclusively_acquired_all_connections'
/usr/local/rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:494:in `disconnect'
/usr/local/rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:516:in `disconnect!'
/usr/local/rvm/gems/ruby-2.7.8/bundler/gems/octopus-263b1b729079/lib/octopus/proxy.rb:256:in `block in with_each_healthy_shard'
/usr/local/rvm/gems/ruby-2.7.8/bundler/gems/octopus-263b1b729079/lib/octopus/proxy.rb:254:in `each'
/usr/local/rvm/gems/ruby-2.7.8/bundler/gems/octopus-263b1b729079/lib/octopus/proxy.rb:254:in `with_each_healthy_shard'
/usr/local/rvm/gems/ruby-2.7.8/bundler/gems/octopus-263b1b729079/lib/octopus/proxy.rb:175:in `clear_all_connections!'
/usr/local/rvm/gems/ruby-2.7.8/bundler/gems/octopus-263b1b729079/lib/octopus/model.rb:187:in `clear_all_connections_with_octopus!'
/usr/local/rvm/gems/ruby-2.7.8/gems/passenger-6.0.14/src/ruby_supportlib/phusion_passenger/loader_shared_helpers.rb:319:in `before_handling_requests'
I fix the error, to add
active_connection = v.active_connection? rescue false yield(v) if active_connection
lib/octopus/proxy.rb
def with_each_healthy_shard
shards.each do |shard_name, v|
begin
active_connection = v.active_connection? rescue false
yield(v) if active_connection
rescue => e
if Octopus.robust_environment?
Octopus.logger.error "Error on shard #{shard_name}: #{e.message}"
Thanks @calos0921 but I'll close this PR. We've stopped using octopus since Rails 6.0 💪