FIX: Load Redis patch much earlier.
This commit is contained in:
parent
eb6a17f587
commit
90fde5053d
|
@ -147,6 +147,7 @@ module Discourse
|
|||
|
||||
require 'discourse_redis'
|
||||
require 'logster/redis_store'
|
||||
require 'freedom_patches/redis'
|
||||
# Use redis for our cache
|
||||
config.cache_store = DiscourseRedis.new_redis_store
|
||||
$redis = DiscourseRedis.new
|
||||
|
|
|
@ -1,18 +1,3 @@
|
|||
# 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
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
# 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
|
Loading…
Reference in New Issue