Class: CI::Queue::Redis::Supervisor

Inherits:
Base
  • Object
show all
Defined in:
lib/ci/queue/redis/supervisor.rb

Direct Known Subclasses

GrindSupervisor

Constant Summary

Constants inherited from Base

Base::CONNECTION_ERRORS

Constants included from Common

Common::CONNECTION_ERRORS

Instance Attribute Summary

Attributes included from Common

#config

Instance Method Summary collapse

Methods inherited from Base

#exhausted?, #increment_test_failed, #initialize, #max_test_failed?, #progress, #queue_initialized?, #size, #test_failed, #to_a, #wait_for_master, #workers_count

Methods included from Common

#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

#buildObject



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

Returns:

  • (Boolean)


6
7
8
# File 'lib/ci/queue/redis/supervisor.rb', line 6

def master?
  false
end

#totalObject



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_workersObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# 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.timeout
  until exhausted? || time_left <= 0 || max_test_failed?
    sleep 1
    time_left -= 1

    yield if block_given?
  end
  exhausted?
rescue CI::Queue::Redis::LostMaster
  false
end