aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable/lib/action_cable/connection
diff options
context:
space:
mode:
authorpalkan <dementiev.vm@gmail.com>2016-09-19 12:29:23 +0300
committerpalkan <dementiev.vm@gmail.com>2016-09-20 19:42:24 +0300
commit03a209e92aeed1e724b3ff787ec77936b7163ca5 (patch)
treecba7736f79df8686f1906ed7d9316c00afd02c97 /actioncable/lib/action_cable/connection
parent254db4987d03d3c9d3fca1e2961da8fd7dd0e06b (diff)
downloadrails-03a209e92aeed1e724b3ff787ec77936b7163ca5.tar.gz
rails-03a209e92aeed1e724b3ff787ec77936b7163ca5.tar.bz2
rails-03a209e92aeed1e724b3ff787ec77936b7163ca5.zip
[Fix #25381] Avoid race condition on subscription confirmation
Diffstat (limited to 'actioncable/lib/action_cable/connection')
-rw-r--r--actioncable/lib/action_cable/connection/subscriptions.rb4
1 files changed, 3 insertions, 1 deletions
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