aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable/lib/action_cable
diff options
context:
space:
mode:
authorSean Griffin <sean@seantheprogrammer.com>2016-04-13 13:08:00 -0600
committerSean Griffin <sean@seantheprogrammer.com>2016-04-13 13:09:16 -0600
commitd1766ef53ddbd91ff414896983e8f3e6b39d2dec (patch)
treefa174957d8c5f893a13b933a201dfce7e5933ef0 /actioncable/lib/action_cable
parentefaa6e4f79d457c2cdd08cbc56d63bc972a6993c (diff)
downloadrails-d1766ef53ddbd91ff414896983e8f3e6b39d2dec.tar.gz
rails-d1766ef53ddbd91ff414896983e8f3e6b39d2dec.tar.bz2
rails-d1766ef53ddbd91ff414896983e8f3e6b39d2dec.zip
Run Action Cable callbacks through the worker pool
Alternate implementation of #24162 with tests. The code had diverged too far on master to pull that implemenation directly. Fixes #23778 Close #24162 [Mattew Draper & Sean Griffin]
Diffstat (limited to 'actioncable/lib/action_cable')
-rw-r--r--actioncable/lib/action_cable/channel/streams.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/actioncable/lib/action_cable/channel/streams.rb b/actioncable/lib/action_cable/channel/streams.rb
index f654ce0bfa..8b46ac216a 100644
--- a/actioncable/lib/action_cable/channel/streams.rb
+++ b/actioncable/lib/action_cable/channel/streams.rb
@@ -76,8 +76,11 @@ module ActionCable
# Don't send the confirmation until pubsub#subscribe is successful
defer_subscription_confirmation!
- if handler = callback || block
- handler = -> message { handler.(coder.decode(message)) } if coder
+ if user_handler = callback || block
+ user_handler = -> message { handler.(coder.decode(message)) } if coder
+ handler = -> message do
+ connection.worker_pool.async_invoke(user_handler, :call, message)
+ end
else
handler = default_stream_handler(broadcasting, coder: coder)
end