Sha256: 8c6a9537a5f42f7ee5a9924c18f5d7b1d9054af84afacd4d9346cf3458861f7e

Contents?: true

Size: 523 Bytes

Versions: 1

Compression:

Stored size: 523 Bytes

Contents

class ProconBypassMan::Procon::PerformanceMeasurement::SpanTransferBuffer
  include Singleton

  def initialize
    @buff = []
  end

  # @param [Span]
  # @return [void]
  def push_and_run_block_if_buffer_over(value, &block)
    push(value)
    return unless buffer_over?

    block.call(spans)
    clear
  end

  private

  def spans
    @buff
  end

  def clear
    @buff.clear
  end

  def push(value)
    @buff << value
  end

  def buffer_over?
    @buff.length > max_buffer
  end

  def max_buffer
    200
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
procon_bypass_man-0.2.3 lib/procon_bypass_man/procon/performance_measurement/span_transfer_buffer.rb