Class: Tipi::Controller
- Inherits:
-
Object
- Object
- Tipi::Controller
- Defined in:
- lib/tipi/controller/web_stock.rb,
lib/tipi/controller/web_polyphony.rb
Constant Summary collapse
- WORKER_COUNT_RANGE =
(1..32).freeze
Instance Method Summary collapse
-
#initialize(opts) ⇒ Controller
constructor
A new instance of Controller.
- #run ⇒ Object
Constructor Details
#initialize(opts) ⇒ Controller
Returns a new instance of Controller.
268 269 270 271 272 |
# File 'lib/tipi/controller/web_stock.rb', line 268 def initialize(opts) @opts = opts @path = File.(@opts['path']) @service = prepare_service end |
Instance Method Details
#run ⇒ Object
276 277 278 279 280 281 |
# File 'lib/tipi/controller/web_stock.rb', line 276 def run worker_count = (@opts['workers'] || 1).to_i.clamp(WORKER_COUNT_RANGE) return run_worker if worker_count == 1 supervise_workers(worker_count) end |