From 7f6fe8fe131884ebd6bc77cb171200e6b1b53da7 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Thu, 7 Apr 2016 15:28:13 +0800 Subject: [PATCH] FIX: Pubsub connections need to be killed too. --- lib/discourse_redis.rb | 1 + spec/components/discourse_redis_spec.rb | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/discourse_redis.rb b/lib/discourse_redis.rb index c92cc9ef72c..156262b146b 100644 --- a/lib/discourse_redis.rb +++ b/lib/discourse_redis.rb @@ -32,6 +32,7 @@ class DiscourseRedis if slave_client.call([:info]).split("\r\n").include?(MASTER_LINK_STATUS) logger.warn "#{log_prefix}: Master server is active, killing all connections to slave..." slave_client.call([:client, [:kill, 'type', 'normal']]) + slave_client.call([:client, [:kill, 'type', 'pubsub']]) Discourse.clear_readonly! Discourse.request_refresh! @master = true diff --git a/spec/components/discourse_redis_spec.rb b/spec/components/discourse_redis_spec.rb index c2d05c85dbe..6f0f1619b59 100644 --- a/spec/components/discourse_redis_spec.rb +++ b/spec/components/discourse_redis_spec.rb @@ -84,6 +84,7 @@ describe DiscourseRedis do fallback_handler.master = false Redis::Client.any_instance.expects(:call).with([:info]).returns(DiscourseRedis::FallbackHandler::MASTER_LINK_STATUS) Redis::Client.any_instance.expects(:call).with([:client, [:kill, 'type', 'normal']]) + Redis::Client.any_instance.expects(:call).with([:client, [:kill, 'type', 'pubsub']]) fallback_handler.initiate_fallback_to_master