FIX: Load Redis patch much earlier.

This commit is contained in:
Guo Xiang Tan 2016-03-11 17:25:24 +08:00
parent eb6a17f587
commit 90fde5053d
3 changed files with 15 additions and 15 deletions

View File

@ -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

View File

@ -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

View File

@ -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