Class: Howler::Runner
- Inherits:
-
Object
- Object
- Howler::Runner
- Defined in:
- lib/howler/runner.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize ⇒ Runner
constructor
A new instance of Runner.
- #run ⇒ Object
Constructor Details
#initialize ⇒ Runner
Returns a new instance of Runner.
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/howler/runner.rb', line 5 def initialize = { :concurrency => 30, :path => './config/environment.rb', :shutdown_timeout => 5 } end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
3 4 5 |
# File 'lib/howler/runner.rb', line 3 def end |
Instance Method Details
#run ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/howler/runner.rb', line 16 def run require Howler::Config[:path] @manager = Howler::Manager.current begin @manager.run! sleep rescue Interrupt logger = Howler::Logger.new still_working = @manager.chewing.size shutdown_timeout = Howler::Config[:shutdown_timeout] logger.log do |log| log.info("INT - Stopping all workers") log.debug("INT - #{@manager.shutdown} workers were shutdown immediately.") log.debug("INT - #{still_working} workers still working.") log.info("INT - Waiting #{shutdown_timeout} seconds for workers to complete.") if still_working > 0 end sleep(shutdown_timeout.to_i) if still_working > 0 logger.info("INT - All workers have shut down - Exiting") end end |