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

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

Instance Method Summary collapse

Methods inherited from Base

#exhausted?, #initialize, #progress, #queue_initialized?, #size, #to_a, #wait_for_master, #workers_count

Constructor Details

This class inherits a constructor from CI::Queue::Redis::Base

Instance Method Details

#master? ⇒ Boolean

Returns:

  • (Boolean)


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

def master?
  false
end

#minitest_reporters ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/ci/queue/redis/supervisor.rb', line 9

def minitest_reporters
  require 'minitest/reporters/redis_reporter'
  @reporters ||= [
    Minitest::Reporters::RedisReporter::Summary.new(
      build_id: build_id,
      redis: redis,
    )
  ]
end

#wait_for_workers ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/ci/queue/redis/supervisor.rb', line 19

def wait_for_workers
  return false unless wait_for_master(timeout: config.timeout)

  time_left = config.timeout
  until exhausted? || time_left <= 0
    sleep 0.1
    time_left -= 0.1
  end
  exhausted?
rescue CI::Queue::Redis::LostMaster
  false
end