Class: Cosmo::Job::Processor
- Defined in:
- lib/cosmo/job/processor.rb
Overview
rubocop:disable Metrics/ClassLength
Instance Method Summary collapse
-
#initialize(pool, running, options) ⇒ Processor
constructor
A new instance of Processor.
- #stop(timeout = ) ⇒ Object
Methods inherited from Processor
Constructor Details
#initialize(pool, running, options) ⇒ Processor
Returns a new instance of Processor.
6 7 8 9 |
# File 'lib/cosmo/job/processor.rb', line 6 def initialize(pool, running, ) super @weights = [] end |
Instance Method Details
#stop(timeout = ) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/cosmo/job/processor.rb', line 11 def stop(timeout = Config[:timeout]) @running.make_false @pool.shutdown @consumers.each { |(s, _)| s.unsubscribe rescue nil } @pool.wait_for_termination(timeout) [@work_thread, @schedule_thread].compact.each { _1.join(timeout) || _1.kill } @consumers.clear end |