class Proxy::RemoteExecution::Ssh::MQTT::DispatcherActor
Constants
- JobDefinition
Public Class Methods
new(clock, limit = nil)
click to toggle source
# File lib/smart_proxy_remote_execution_ssh/mqtt/dispatcher.rb, line 145 def initialize(clock, limit = nil) @tracker = Tracker.new(limit, clock) interval = Proxy::RemoteExecution::Ssh::Plugin.settings[:mqtt_ttl] @timer = Concurrent::TimerTask.new(execution_interval: interval) do reference.tell(:tick) end end
Public Instance Methods
on_message(message)
click to toggle source
# File lib/smart_proxy_remote_execution_ssh/mqtt/dispatcher.rb, line 154 def on_message(message) action, arg = message # Enable the timer just in case anything in tracker raises an exception so # we can continue timer_on case action when :new _, uuid, topic, payload = message @tracker.new(uuid, topic, payload) when :resend @tracker.resend(arg) when :running @tracker.running(arg) when :done @tracker.done(arg) when :tick @tracker.process end timer_set(@tracker.needs_processing?) end
timer_off()
click to toggle source
# File lib/smart_proxy_remote_execution_ssh/mqtt/dispatcher.rb, line 183 def timer_off @timer.shutdown end
timer_on()
click to toggle source
# File lib/smart_proxy_remote_execution_ssh/mqtt/dispatcher.rb, line 179 def timer_on @timer.execute end
timer_set(on)
click to toggle source
# File lib/smart_proxy_remote_execution_ssh/mqtt/dispatcher.rb, line 175 def timer_set(on) on ? timer_on : timer_off end