Class: LaunchDarkly::Impl::Integrations::Consul::ConsulUtil

Inherits:
Object
  • Object
show all
Defined in:
lib/ldclient-rb/impl/integrations/consul_impl.rb

Overview

Since:

  • 5.5.0

Class Method Summary collapse

Class Method Details

.batch_operations(ops) ⇒ Object

Submits as many transactions as necessary to submit all of the given operations. The ops array is consumed.

Since:

  • 5.5.0



158
159
160
161
162
163
164
165
# File 'lib/ldclient-rb/impl/integrations/consul_impl.rb', line 158

def self.batch_operations(ops)
  batch_size = 64  # Consul can only do this many at a time
  while true
    chunk = ops.shift(batch_size)
    break if chunk.empty?
    Diplomat::Kv.txn(chunk)
  end
end