DEV: Bump rails_failover.

Avoid configuring AR stuff if `replica_host` and `replica_port` hasn't
been provided.
This commit is contained in:
Guo Xiang Tan 2020-06-16 10:51:21 +08:00
parent a2713578dd
commit 092ae858af
No known key found for this signature in database
GPG Key ID: FBD110179AAC1F20
3 changed files with 5 additions and 3 deletions

View File

@ -280,7 +280,7 @@ GEM
nokogiri (>= 1.6)
rails-html-sanitizer (1.3.0)
loofah (~> 2.3)
rails_failover (0.5.0)
rails_failover (0.5.1)
activerecord (~> 6.0)
railties (~> 6.0)
rails_multisite (2.3.0)

View File

@ -1,5 +1,7 @@
# frozen_string_literal: true
return unless Rails.configuration.active_record_rails_failover
if defined?(RailsFailover::Redis)
message_bus_keepalive_interval = nil

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)
if defined?(RailsFailover) && Rails.configuration.active_record_rails_failover
Rails.configuration.middleware.insert_after(RailsMultisite::Middleware, RailsFailover::ActiveRecord::Middleware)
end
elsif defined?(RailsFailover)
elsif defined?(RailsFailover) && Rails.configuration.active_record_rails_failover
Rails.configuration.middleware.insert_before(MessageBus::Rack::Middleware, RailsFailover::ActiveRecord::Middleware)
end