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 'discourse_redis'
|
||||||
require 'logster/redis_store'
|
require 'logster/redis_store'
|
||||||
|
require 'freedom_patches/redis'
|
||||||
# Use redis for our cache
|
# Use redis for our cache
|
||||||
config.cache_store = DiscourseRedis.new_redis_store
|
config.cache_store = DiscourseRedis.new_redis_store
|
||||||
$redis = DiscourseRedis.new
|
$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']
|
if Rails.env.development? && ENV['DISCOURSE_FLUSH_REDIS']
|
||||||
puts "Flushing redis (development mode)"
|
puts "Flushing redis (development mode)"
|
||||||
$redis.flushall
|
$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