Skip to content

Commit

Permalink
DEV: Add force rails_over switch via Redis.
Browse files Browse the repository at this point in the history
  • Loading branch information
tgxworld committed Jun 1, 2020
1 parent df62407 commit b0b37bf
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion config/initializers/002-rails_failover.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,14 @@
Sidekiq.unpause!
end

module Discourse
PG_FORCE_READONLY_MODE_KEY ||= 'readonly_mode:postgres_force'
end

RailsFailover::ActiveRecord.register_force_reading_role_callback do
Discourse.pg_readonly_mode?
Discourse.redis.exists(
Discourse::PG_READONLY_MODE_KEY,
Discourse::PG_FORCE_READONLY_MODE_KEY
)
end
end

0 comments on commit b0b37bf

Please sign in to comment.