aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable/lib/action_cable
diff options
context:
space:
mode:
authorRichard Machielse <richardmachielse@gmail.com>2017-09-25 13:03:52 +0200
committerRichard Machielse <richardmachielse@gmail.com>2017-09-26 11:47:55 +0200
commit4b629eca21fbecf9a49f00f3933ad4c28ad78600 (patch)
tree515ec930796e087aa84622d1cf7a38fa53cd49d0 /actioncable/lib/action_cable
parent5755f57f3e887df93e11c4b3efb8bf21226744cc (diff)
downloadrails-4b629eca21fbecf9a49f00f3933ad4c28ad78600.tar.gz
rails-4b629eca21fbecf9a49f00f3933ad4c28ad78600.tar.bz2
rails-4b629eca21fbecf9a49f00f3933ad4c28ad78600.zip
ActionCable: use find method when unsubscribing
If a frontend for some reason tries to unsubscribe from a non existing subscription, the following error is logged: Could not execute command from ({"command"=>"unsubscribe", "identifier"=>"{\"channel\":\"SomeChannel\"}"}) [NoMethodError - undefined method `unsubscribe_from_channel' for nil:NilClass] Instead, it will now properly log: Could not execute command from ({"command"=>"unsubscribe", "identifier"=>"{\"channel\":\"SomeChannel\"}"}) [RuntimeError - Unable to find subscription with identifier: {"channel":"SomeChannel"}]
Diffstat (limited to 'actioncable/lib/action_cable')
-rw-r--r--actioncable/lib/action_cable/connection/subscriptions.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/actioncable/lib/action_cable/connection/subscriptions.rb b/actioncable/lib/action_cable/connection/subscriptions.rb
index faafd6d0a6..bb8d64e27a 100644
--- a/actioncable/lib/action_cable/connection/subscriptions.rb
+++ b/actioncable/lib/action_cable/connection/subscriptions.rb
@@ -43,7 +43,7 @@ module ActionCable
def remove(data)
logger.info "Unsubscribing from channel: #{data['identifier']}"
- remove_subscription subscriptions[data["identifier"]]
+ remove_subscription find(data)
end
def remove_subscription(subscription)