From 8b69ee26ff335eb9c451793251bb82efccdc80db Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 3 Jun 2013 16:50:30 +1000 Subject: [PATCH] forking in passenger was bust, message bus subscriptions would stop working after fork --- Gemfile.lock | 2 +- config/initializers/01-redis.rb | 1 + config/spring.rb | 2 +- spec/spec_helper.rb | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 03e64adeb..5f302939b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -16,7 +16,7 @@ GIT GIT remote: https://github.com/SamSaffron/message_bus - revision: f55b41653d0c149938ebb803a97d946e5ae80439 + revision: 9c16e7ebaafaf2a3933a84fa1c517c0eba44b052 specs: message_bus (0.0.2) eventmachine diff --git a/config/initializers/01-redis.rb b/config/initializers/01-redis.rb index 2a359fd6f..b4997795f 100644 --- a/config/initializers/01-redis.rb +++ b/config/initializers/01-redis.rb @@ -13,6 +13,7 @@ if defined?(PhusionPassenger) # We're in smart spawning mode. $redis = DiscourseRedis.new Discourse::Application.config.cache_store.reconnect + MessageBus.after_fork else # We're in conservative spawning mode. We don't need to do anything. end diff --git a/config/spring.rb b/config/spring.rb index 2b1a7df8c..1db1fcbc3 100644 --- a/config/spring.rb +++ b/config/spring.rb @@ -7,7 +7,7 @@ # spring binstub rspec Spring.after_fork do $redis.client.reconnect - MessageBus.reliable_pub_sub.pub_redis.client.reconnect Rails.cache.reconnect + MessageBus.after_fork end Spring::Commands::Rake.environment_matchers["spec"] = "test" diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 6942dc37f..0a8fd70ab 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -112,8 +112,8 @@ end Spork.each_run do # This code will be run each time you run your specs. $redis.client.reconnect - MessageBus.reliable_pub_sub.pub_redis.client.reconnect Rails.cache.reconnect + MessageBus.after_fork end def build(*args)