Class: Kommando::ScheduledCommandRunner
- Inherits:
-
Object
- Object
- Kommando::ScheduledCommandRunner
- Defined in:
- lib/kommando/scheduled_command_runner.rb
Constant Summary collapse
- JITTER =
0.5
- PAUSE =
5.0
Instance Method Summary collapse
-
#initialize(number, adapter, dependencies) ⇒ ScheduledCommandRunner
constructor
A new instance of ScheduledCommandRunner.
- #kill ⇒ Object
- #start ⇒ Object
- #stop_before_next_fetch ⇒ Object
- #stopped? ⇒ Boolean
Constructor Details
#initialize(number, adapter, dependencies) ⇒ ScheduledCommandRunner
Returns a new instance of ScheduledCommandRunner.
6 7 8 9 10 11 12 13 |
# File 'lib/kommando/scheduled_command_runner.rb', line 6 def initialize(number, adapter, dependencies) @number = number @adapter = adapter @dependencies = dependencies @thread = nil @stop_before_next_fetch = false @stopped = false end |
Instance Method Details
#kill ⇒ Object
27 28 29 |
# File 'lib/kommando/scheduled_command_runner.rb', line 27 def kill @thread.kill end |
#start ⇒ Object
15 16 17 |
# File 'lib/kommando/scheduled_command_runner.rb', line 15 def start @thread ||= start_thread("runner-#{@number}", &method(:run)) end |
#stop_before_next_fetch ⇒ Object
19 20 21 |
# File 'lib/kommando/scheduled_command_runner.rb', line 19 def stop_before_next_fetch @stop_before_next_fetch = true end |
#stopped? ⇒ Boolean
23 24 25 |
# File 'lib/kommando/scheduled_command_runner.rb', line 23 def stopped? @stopped end |