mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: Master-Slave Redis configuration with fallback and switch over.
This commit is contained in:
@@ -1,3 +1,18 @@
|
||||
# https://github.com/redis/redis-rb/pull/591
|
||||
class Redis
|
||||
class Client
|
||||
alias_method :old_initialize, :initialize
|
||||
|
||||
def initialize(options = {})
|
||||
old_initialize(options)
|
||||
|
||||
if options.include?(:connector) && options[:connector].is_a?(Class)
|
||||
@connector = options[:connector].new(@options)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if Rails.env.development? && ENV['DISCOURSE_FLUSH_REDIS']
|
||||
puts "Flushing redis (development mode)"
|
||||
$redis.flushall
|
||||
|
||||
Reference in New Issue
Block a user