diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2015-02-05 17:02:01 +0530 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2015-02-05 17:02:01 +0530 |
commit | d9d6ebcac83d767700b4c3b618f7fa3ae5ef69b2 (patch) | |
tree | d5139835a78b4751bf4971468390545957ab6b1c /lib/action_cable/worker.rb | |
parent | 7fef6b01a3011438d48136e3f95bb9a823e87ec6 (diff) | |
download | rails-d9d6ebcac83d767700b4c3b618f7fa3ae5ef69b2.tar.gz rails-d9d6ebcac83d767700b4c3b618f7fa3ae5ef69b2.tar.bz2 rails-d9d6ebcac83d767700b4c3b618f7fa3ae5ef69b2.zip |
Run periodic timers via the worker pool
Diffstat (limited to 'lib/action_cable/worker.rb')
-rw-r--r-- | lib/action_cable/worker.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/action_cable/worker.rb b/lib/action_cable/worker.rb index 46b5f7edc0..1a8bee974b 100644 --- a/lib/action_cable/worker.rb +++ b/lib/action_cable/worker.rb @@ -12,7 +12,15 @@ module ActionCable end def cleanup_subscriptions(connection) - connection.cleanup_subscriptions + run_callbacks :work do + connection.cleanup_subscriptions + end + end + + def run_periodic_timer(channel, callback) + run_callbacks :work do + callback.respond_to?(:call) ? channel.instance_exec(&callback) : channel.send(callback) + end end end |