infinite_tracing/test/infinite_tracing/streaming_buffer_test.rb
# Opens a streaming buffer,enqueues count segments to the buffer
# closes the queue when done as we assume no more will be
# generated and don't want to block indefinitely.
# 
# Returns the buffer with segments on the queue as well
# as the segments that were generated separately.
Opens a streaming buffer,enqueues count segments to the buffer
closes the queue when done as we assume no more will be
generated and don't want to block indefinitely.

Returns the buffer with segments on the queue as well
as the segments that were generated separately.
Opens a streaming buffer enqueues count segments to the buffer closes the queue when done as we assume no more will be generated and don ' t want to block indefinitely . Returns the buffer with segments on the queue as well as the segments that were generated separately .
def stream_segments count, max_buffer_size=100_000
          buffer = StreamingBuffer.new max_buffer_size
          segments = []
          count.times do
            with_segment do |segment|
              segments << segment
              buffer << deferred_span(segment)
            end
          end
          buffer.close_queue
          return buffer, segments
        end
def stream_segments count , max_buffer_size = 100_000 buffer = StreamingBuffer . new max_buffer_size segments = [ ] count . times do with_segment do | segment | segments << segment buffer << deferred_span ( segment ) end end buffer . close_queue return buffer , segments end
Opens a streaming buffer,enqueues count segments to the buffer
closes the queue when done as we assume no more will be
generated and don't want to block indefinitely.
Opens a streaming buffer enqueues count segments to the buffer closes the queue when done as we assume no more will be generated and don ' t want to block indefinitely .
# generates segments that are streamed as spans # if we don't close, we block the pop  # in the enumerator indefinitely
count
<not_specific>
max_buffer_size
<not_specific>