2016-03-02 09:01:48 -05:00
|
|
|
# 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
|
|
|
|
|
2013-05-02 19:55:56 -04:00
|
|
|
if Rails.env.development? && ENV['DISCOURSE_FLUSH_REDIS']
|
2013-03-11 08:33:20 -04:00
|
|
|
puts "Flushing redis (development mode)"
|
|
|
|
$redis.flushall
|
|
|
|
end
|
|
|
|
|
|
|
|
if defined?(PhusionPassenger)
|
|
|
|
PhusionPassenger.on_event(:starting_worker_process) do |forked|
|
|
|
|
if forked
|
2014-03-27 22:48:14 -04:00
|
|
|
Discourse.after_fork
|
2013-03-11 08:33:20 -04:00
|
|
|
else
|
|
|
|
# We're in conservative spawning mode. We don't need to do anything.
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2014-05-06 18:23:52 -04:00
|
|
|
|