diff --git a/actioncable/lib/action_cable/storage_adapter/postgres.rb b/actioncable/lib/action_cable/storage_adapter/postgres.rb index 8b4c0ef29f..119ea787d7 100644 --- a/actioncable/lib/action_cable/storage_adapter/postgres.rb +++ b/actioncable/lib/action_cable/storage_adapter/postgres.rb @@ -74,13 +74,9 @@ module ActionCable end end - def unsubscribe_to(channel, callback = nil) + def unsubscribe_to(channel, callback) @sync.synchronize do - if callback - @subscribers[channel].delete(callback) - else - @subscribers.delete(channel) - end + @subscribers[channel].delete(callback) if @subscribers[channel].empty? @queue.push([:unlisten, channel])