Class: Larva::WorkerPool

Inherits:
Object
  • Object
show all
Defined in:
lib/larva/worker_pool.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(processors, queue_suffix) ⇒ WorkerPool



8
9
10
11
# File 'lib/larva/worker_pool.rb', line 8

def initialize(processors, queue_suffix)
  @processors = processors
  @queue_suffix = queue_suffix
end

Instance Attribute Details

#processorsObject (readonly)

Returns the value of attribute processors.



7
8
9
# File 'lib/larva/worker_pool.rb', line 7

def processors
  @processors
end

#queue_suffixObject (readonly)

Returns the value of attribute queue_suffix.



7
8
9
# File 'lib/larva/worker_pool.rb', line 7

def queue_suffix
  @queue_suffix
end

#workersObject (readonly)

Returns the value of attribute workers.



7
8
9
# File 'lib/larva/worker_pool.rb', line 7

def workers
  @workers
end

Class Method Details

.start(processors, queue_suffix) ⇒ Object



3
4
5
# File 'lib/larva/worker_pool.rb', line 3

def self.start(processors, queue_suffix)
  new(processors, queue_suffix).start
end

Instance Method Details

#startObject



13
14
15
16
# File 'lib/larva/worker_pool.rb', line 13

def start
  start_workers
  keep_workers_alive if workers.count > 0
end