Method: Kazoo::Broker#critical?
- Defined in:
- lib/kazoo/broker.rb
#critical?(replicas: 1) ⇒ Boolean
37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/kazoo/broker.rb', line 37 def critical?(replicas: 1) result, threads, mutex = false, ThreadGroup.new, Mutex.new replicated_partitions.each do |partition| t = Thread.new do isr = partition.isr.reject { |r| r == self } mutex.synchronize { result = true if isr.length < replicas } end threads.add(t) end threads.list.each(&:join) result end |