aboutsummaryrefslogtreecommitdiffstats
path: root/lib/action_cable/connection/internal_channel.rb
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2015-10-14 18:14:50 -0500
committerPratik Naik <pratiknaik@gmail.com>2015-10-14 18:14:50 -0500
commitba95d86ef8df10cedc6c00a14c50b24d2dee3af6 (patch)
tree4dddc8257c49d2b4102f7270f254b59f7801bce9 /lib/action_cable/connection/internal_channel.rb
parent773d3c2310b12ab808b4434168ad5f017361712b (diff)
downloadrails-ba95d86ef8df10cedc6c00a14c50b24d2dee3af6.tar.gz
rails-ba95d86ef8df10cedc6c00a14c50b24d2dee3af6.tar.bz2
rails-ba95d86ef8df10cedc6c00a14c50b24d2dee3af6.zip
Subscribe and unsubscribe from the internal redis channels in the primary EM thread
Diffstat (limited to 'lib/action_cable/connection/internal_channel.rb')
-rw-r--r--lib/action_cable/connection/internal_channel.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/action_cable/connection/internal_channel.rb b/lib/action_cable/connection/internal_channel.rb
index b00e21824c..c065a24ab7 100644
--- a/lib/action_cable/connection/internal_channel.rb
+++ b/lib/action_cable/connection/internal_channel.rb
@@ -15,14 +15,14 @@ module ActionCable
@_internal_redis_subscriptions ||= []
@_internal_redis_subscriptions << [ internal_redis_channel, callback ]
- pubsub.subscribe(internal_redis_channel, &callback)
+ EM.next_tick { pubsub.subscribe(internal_redis_channel, &callback) }
logger.info "Registered connection (#{connection_identifier})"
end
end
def unsubscribe_from_internal_channel
if @_internal_redis_subscriptions.present?
- @_internal_redis_subscriptions.each { |channel, callback| pubsub.unsubscribe_proc(channel, callback) }
+ @_internal_redis_subscriptions.each { |channel, callback| EM.next_tick { pubsub.unsubscribe_proc(channel, callback) } }
end
end