2013-03-11 08:33:20 -04:00
|
|
|
require "#{Rails.root}/lib/discourse_redis"
|
|
|
|
|
|
|
|
$redis = DiscourseRedis.new
|
|
|
|
|
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
|
|
|
|
# We're in smart spawning mode.
|
|
|
|
$redis = DiscourseRedis.new
|
2013-03-11 19:59:07 -04:00
|
|
|
Discourse::Application.config.cache_store.reconnect
|
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
|