DEV: Fix undefined method due to rails_failover.

This commit is contained in:
Guo Xiang Tan 2020-06-16 11:03:47 +08:00
parent 092ae858af
commit b08a0d15c4
No known key found for this signature in database
GPG Key ID: FBD110179AAC1F20
2 changed files with 4 additions and 4 deletions

View File

@ -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 =

View File

@ -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