Class: Wal::Runner::Worker

Inherits:
Object
  • Object
show all
Defined in:
lib/wal/runner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_configObject (readonly)

Returns the value of attribute db_config.



4
5
6
# File 'lib/wal/runner.rb', line 4

def db_config
  @db_config
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/wal/runner.rb', line 4

def name
  @name
end

#slot_configsObject (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

#runObject



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