mirror of
https://github.com/discourse/discourse.git
synced 2025-06-01 09:08:10 +08:00
added basic passenger support, no long polling but functions
clean up initializers so they are ordered properly
This commit is contained in:
20
config/initializers/01-redis.rb
Normal file
20
config/initializers/01-redis.rb
Normal file
@ -0,0 +1,20 @@
|
||||
require "#{Rails.root}/lib/discourse_redis"
|
||||
|
||||
$redis = DiscourseRedis.new
|
||||
|
||||
if Rails.env.development? && !ENV['DO_NOT_FLUSH_REDIS']
|
||||
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
|
||||
Discourse::Application.config.cache_store.reconnect# = DiscourseRedis.new_redis_store
|
||||
else
|
||||
# We're in conservative spawning mode. We don't need to do anything.
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user