Class: CI::Queue::Redis::Supervisor
- Defined in:
- lib/ci/queue/redis/supervisor.rb
Direct Known Subclasses
Constant Summary
Constants inherited from Base
Base::CONNECTION_ERRORS, Base::TEN_MINUTES
Constants included from Common
Instance Attribute Summary
Attributes included from Common
Instance Method Summary collapse
Methods inherited from Base
#created_at=, #exhausted?, #expired?, #increment_test_failed, #initialize, #max_test_failed?, #progress, #queue_initialized?, #queue_initializing?, #size, #test_failed, #to_a, #wait_for_master, #workers_count
Methods included from Common
#distributed?, #flaky?, #release!, #report_failure!, #report_success!, #rescue_connection_errors, #retrying?
Constructor Details
This class inherits a constructor from CI::Queue::Redis::Base
Instance Method Details
#build ⇒ Object
15 16 17 |
# File 'lib/ci/queue/redis/supervisor.rb', line 15 def build @build ||= CI::Queue::Redis::BuildRecord.new(self, redis, config) end |
#master? ⇒ Boolean
6 7 8 |
# File 'lib/ci/queue/redis/supervisor.rb', line 6 def master? false end |
#total ⇒ Object
10 11 12 13 |
# File 'lib/ci/queue/redis/supervisor.rb', line 10 def total wait_for_master(timeout: config.queue_init_timeout) redis.get(key('total')).to_i end |
#wait_for_workers ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/ci/queue/redis/supervisor.rb', line 19 def wait_for_workers wait_for_master(timeout: config.queue_init_timeout) yield if block_given? time_left = config.report_timeout time_left_with_no_workers = config.inactive_workers_timeout until exhausted? || time_left <= 0 || max_test_failed? || time_left_with_no_workers <= 0 time_left -= 1 sleep 1 if active_workers? time_left_with_no_workers = config.inactive_workers_timeout else time_left_with_no_workers -= 1 end yield if block_given? end puts "Aborting, it seems all workers died." if time_left_with_no_workers <= 0 exhausted? rescue CI::Queue::Redis::LostMaster false end |