aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable/lib/action_cable/subscription_adapter/redis.rb
diff options
context:
space:
mode:
authorMatthew Draper <matthew@trebex.net>2016-01-24 22:30:48 +1030
committerMatthew Draper <matthew@trebex.net>2016-01-24 22:30:48 +1030
commitdcdadd5e82eed2e64d21399599b14501c3e16cc3 (patch)
tree1ec70f6e5357ee6ac58c0913ad67bf046ded7e17 /actioncable/lib/action_cable/subscription_adapter/redis.rb
parente3a0ad83da16f5fb063ce7d254b4e466baf7199d (diff)
parent9ff28c10ebad0d4781603499a3e3b1d7fd5fbd2c (diff)
downloadrails-dcdadd5e82eed2e64d21399599b14501c3e16cc3.tar.gz
rails-dcdadd5e82eed2e64d21399599b14501c3e16cc3.tar.bz2
rails-dcdadd5e82eed2e64d21399599b14501c3e16cc3.zip
Merge pull request #23217 from matthewd/adapter-tests
ActionCable Adapter tests
Diffstat (limited to 'actioncable/lib/action_cable/subscription_adapter/redis.rb')
-rw-r--r--actioncable/lib/action_cable/subscription_adapter/redis.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/actioncable/lib/action_cable/subscription_adapter/redis.rb b/actioncable/lib/action_cable/subscription_adapter/redis.rb
index e42ab2a03f..3b86354621 100644
--- a/actioncable/lib/action_cable/subscription_adapter/redis.rb
+++ b/actioncable/lib/action_cable/subscription_adapter/redis.rb
@@ -12,7 +12,7 @@ module ActionCable
def subscribe(channel, message_callback, success_callback = nil)
redis_connection_for_subscriptions.pubsub.subscribe(channel, &message_callback).tap do |result|
- result.callback(&success_callback) if success_callback
+ result.callback { |reply| success_callback.call } if success_callback
end
end
@@ -20,6 +20,11 @@ module ActionCable
redis_connection_for_subscriptions.pubsub.unsubscribe_proc(channel, message_callback)
end
+ def shutdown
+ redis_connection_for_subscriptions.pubsub.close_connection
+ @redis_connection_for_subscriptions = nil
+ end
+
private
def redis_connection_for_subscriptions
@redis_connection_for_subscriptions ||= EM::Hiredis.connect(@server.config.cable[:url]).tap do |redis|