Class: CI::Queue::Redis::Supervisor
- Inherits:
-
Base
- Object
- Base
- CI::Queue::Redis::Supervisor
show all
- Defined in:
- lib/ci/queue/redis/supervisor.rb
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?, #initialize, #progress, #queue_initialized?, #size, #to_a, #wait_for_master, #workers_count
Methods included from Common
#flaky?, #report_failure!, #report_success!, #rescue_connection_errors
Instance Method Details
#build ⇒ Object
14
15
16
|
# File 'lib/ci/queue/redis/supervisor.rb', line 14
def build
@build ||= CI::Queue::Redis::BuildRecord.new(self, redis, config)
end
|
#master? ⇒ Boolean
5
6
7
|
# File 'lib/ci/queue/redis/supervisor.rb', line 5
def master?
false
end
|
#total ⇒ Object
9
10
11
12
|
# File 'lib/ci/queue/redis/supervisor.rb', line 9
def total
wait_for_master(timeout: config.timeout)
redis.get(key('total')).to_i
end
|
#wait_for_workers ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/ci/queue/redis/supervisor.rb', line 18
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
|