Method: Kazoo::Broker#led_partitions
- Defined in:
- lib/kazoo/broker.rb
#led_partitions ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/kazoo/broker.rb', line 11 def led_partitions result, threads, mutex = [], ThreadGroup.new, Mutex.new cluster.partitions.each do |partition| t = Thread.new do select = partition.leader == self mutex.synchronize { result << partition } if select end threads.add(t) end threads.list.each(&:join) result end |