Class: Wal::Runner::Worker
- Inherits:
-
Object
- Object
- Wal::Runner::Worker
- Defined in:
- lib/wal/runner.rb
Instance Attribute Summary collapse
-
#db_config ⇒ Object
readonly
Returns the value of attribute db_config.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#slot_configs ⇒ Object
readonly
Returns the value of attribute slot_configs.
Instance Method Summary collapse
-
#initialize(name:, slot_configs:, db_config:) ⇒ Worker
constructor
A new instance of Worker.
- #run ⇒ Object
Constructor Details
#initialize(name:, slot_configs:, db_config:) ⇒ Worker
Returns a new instance of Worker.
6 7 8 9 10 11 |
# File 'lib/wal/runner.rb', line 6 def initialize(name:, slot_configs:, db_config:) @name = name @slot_configs = slot_configs @db_config = db_config @threads = [] end |
Instance Attribute Details
#db_config ⇒ Object (readonly)
Returns the value of attribute db_config.
4 5 6 |
# File 'lib/wal/runner.rb', line 4 def db_config @db_config end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/wal/runner.rb', line 4 def name @name end |
#slot_configs ⇒ Object (readonly)
Returns the value of attribute slot_configs.
4 5 6 |
# File 'lib/wal/runner.rb', line 4 def slot_configs @slot_configs end |
Instance Method Details
#run ⇒ Object
13 14 15 16 17 |
# File 'lib/wal/runner.rb', line 13 def run @threads = slot_configs.map { |slot, config| start_worker(slot, config) } setup_signal_handlers @threads.each(&:join) end |