From 03a209e92aeed1e724b3ff787ec77936b7163ca5 Mon Sep 17 00:00:00 2001 From: palkan Date: Mon, 19 Sep 2016 12:29:23 +0300 Subject: [Fix #25381] Avoid race condition on subscription confirmation --- actioncable/lib/action_cable/connection/subscriptions.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'actioncable/lib/action_cable/connection') diff --git a/actioncable/lib/action_cable/connection/subscriptions.rb b/actioncable/lib/action_cable/connection/subscriptions.rb index 9060183249..ccac802332 100644 --- a/actioncable/lib/action_cable/connection/subscriptions.rb +++ b/actioncable/lib/action_cable/connection/subscriptions.rb @@ -29,7 +29,9 @@ module ActionCable subscription_klass = id_options[:channel].safe_constantize if subscription_klass && ActionCable::Channel::Base >= subscription_klass - subscriptions[id_key] ||= subscription_klass.new(connection, id_key, id_options) + subscription = subscription_klass.new(connection, id_key, id_options) + subscriptions[id_key] ||= subscription + subscription.registered! else logger.error "Subscription class not found: #{id_options[:channel].inspect}" end -- cgit v1.2.3