DEV: Fix undefined method due to rails_failover.
This commit is contained in:
parent
092ae858af
commit
b08a0d15c4
|
@ -1,7 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
return unless Rails.configuration.active_record_rails_failover
|
||||
|
||||
if defined?(RailsFailover::Redis)
|
||||
message_bus_keepalive_interval = nil
|
||||
|
||||
|
@ -19,6 +17,8 @@ if defined?(RailsFailover::Redis)
|
|||
end
|
||||
|
||||
if defined?(RailsFailover::ActiveRecord)
|
||||
return unless Rails.configuration.active_record_rails_failover
|
||||
|
||||
if Rails.configuration.multisite
|
||||
if ActiveRecord::Base.current_role == ActiveRecord::Base.reading_role
|
||||
RailsMultisite::ConnectionManagement.default_connection_handler =
|
||||
|
|
|
@ -25,9 +25,9 @@ if Rails.configuration.multisite
|
|||
Rails.configuration.middleware.unshift RailsMultisite::Middleware, RailsMultisite::DiscoursePatches.config
|
||||
Rails.configuration.middleware.delete ActionDispatch::Executor
|
||||
|
||||
if defined?(RailsFailover) && Rails.configuration.active_record_rails_failover
|
||||
if defined?(RailsFailover::ActiveRecord) && Rails.configuration.active_record_rails_failover
|
||||
Rails.configuration.middleware.insert_after(RailsMultisite::Middleware, RailsFailover::ActiveRecord::Middleware)
|
||||
end
|
||||
elsif defined?(RailsFailover) && Rails.configuration.active_record_rails_failover
|
||||
elsif defined?(RailsFailover::ActiveRecord) && Rails.configuration.active_record_rails_failover
|
||||
Rails.configuration.middleware.insert_before(MessageBus::Rack::Middleware, RailsFailover::ActiveRecord::Middleware)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue