Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Experimental] Minimum support for Rails 6.1 #583

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sergiogomez
Copy link

This PR is only replacing failing methods (only the detected ones) with new classes and methods from Rails 6.1.

@calos0921
Copy link

calos0921 commented Feb 27, 2024

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'

@calos0921
Copy link

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}"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants