aboutsummaryrefslogtreecommitdiffstats
path: root/lib/action_cable/channel/base.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/action_cable/channel/base.rb')
-rw-r--r--lib/action_cable/channel/base.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/action_cable/channel/base.rb b/lib/action_cable/channel/base.rb
index ae8822d2a2..832c8cc314 100644
--- a/lib/action_cable/channel/base.rb
+++ b/lib/action_cable/channel/base.rb
@@ -41,13 +41,13 @@ module ActionCable
def subscribe
self.class.on_subscribe_callbacks.each do |callback|
- EM.next_tick { send(callback) }
+ send(callback)
end
end
def unsubscribe
self.class.on_unsubscribe_callbacks.each do |callback|
- EM.next_tick { send(callback) }
+ send(callback)
end
end
@@ -67,7 +67,7 @@ module ActionCable
def start_periodic_timers
self.class.periodic_timers.each do |callback, options|
@_active_periodic_timers << EventMachine::PeriodicTimer.new(options[:every]) do
- callback.respond_to?(:call) ? instance_exec(&callback) : send(callback)
+ worker_pool.async.run_periodic_timer(self, callback)
end
end
end
@@ -75,6 +75,11 @@ module ActionCable
def stop_periodic_timers
@_active_periodic_timers.each {|t| t.cancel }
end
+
+ def worker_pool
+ connection.worker_pool
+ end
+
end
end