mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
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"}]
This commit is contained in:
parent
5755f57f3e
commit
4b629eca21
1 changed files with 1 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue