module ActionCable::Channel::PeriodicTimers
Private Instance Methods
Source
# File lib/action_cable/channel/periodic_timers.rb, line 56 def active_periodic_timers @active_periodic_timers ||= [] end
Source
# File lib/action_cable/channel/periodic_timers.rb, line 66 def start_periodic_timer(callback, every:) connection.server.event_loop.timer every do connection.worker_pool.async_exec self, connection: connection, &callback end end
Source
# File lib/action_cable/channel/periodic_timers.rb, line 60 def start_periodic_timers self.class.periodic_timers.each do |callback, options| active_periodic_timers << start_periodic_timer(callback, every: options.fetch(:every)) end end
Source
# File lib/action_cable/channel/periodic_timers.rb, line 72 def stop_periodic_timers active_periodic_timers.each { |timer| timer.shutdown } active_periodic_timers.clear end