forking in passenger was bust, message bus subscriptions would stop working after fork

This commit is contained in:
Sam
2013-06-03 16:50:30 +10:00
parent 978bc0ca4e
commit 8b69ee26ff
4 changed files with 4 additions and 3 deletions

View File

@ -16,7 +16,7 @@ GIT
GIT GIT
remote: https://github.com/SamSaffron/message_bus remote: https://github.com/SamSaffron/message_bus
revision: f55b41653d0c149938ebb803a97d946e5ae80439 revision: 9c16e7ebaafaf2a3933a84fa1c517c0eba44b052
specs: specs:
message_bus (0.0.2) message_bus (0.0.2)
eventmachine eventmachine

View File

@ -13,6 +13,7 @@ if defined?(PhusionPassenger)
# We're in smart spawning mode. # We're in smart spawning mode.
$redis = DiscourseRedis.new $redis = DiscourseRedis.new
Discourse::Application.config.cache_store.reconnect Discourse::Application.config.cache_store.reconnect
MessageBus.after_fork
else else
# We're in conservative spawning mode. We don't need to do anything. # We're in conservative spawning mode. We don't need to do anything.
end end

View File

@ -7,7 +7,7 @@
# spring binstub rspec # spring binstub rspec
Spring.after_fork do Spring.after_fork do
$redis.client.reconnect $redis.client.reconnect
MessageBus.reliable_pub_sub.pub_redis.client.reconnect
Rails.cache.reconnect Rails.cache.reconnect
MessageBus.after_fork
end end
Spring::Commands::Rake.environment_matchers["spec"] = "test" Spring::Commands::Rake.environment_matchers["spec"] = "test"

View File

@ -112,8 +112,8 @@ end
Spork.each_run do Spork.each_run do
# This code will be run each time you run your specs. # This code will be run each time you run your specs.
$redis.client.reconnect $redis.client.reconnect
MessageBus.reliable_pub_sub.pub_redis.client.reconnect
Rails.cache.reconnect Rails.cache.reconnect
MessageBus.after_fork
end end
def build(*args) def build(*args)