Skip to content

Commit

Permalink
whoops fetching batch should be in the lock
Browse files Browse the repository at this point in the history
  • Loading branch information
ibawt committed Sep 11, 2019
1 parent 712ce8f commit a6a8842
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def shutdown
def work
loop do
keep_running = nil
batch = nil
lock do
if spans.size < max_queue_size
loop do
Expand All @@ -78,9 +79,10 @@ def work
end
end
keep_running = @keep_running
batch = fetch_batch
end
# this is done outside the lock to unblock the producers
@exporter.export(fetch_batch)
@exporter.export(batch)
break unless keep_running
end
flush
Expand All @@ -96,7 +98,7 @@ def fetch_batch
batch = []
loop do
break if batch.size >= @batch_size || spans.empty?
batch << spans.shift
batch << spans.shift.to_span_proto
end
batch
end
Expand Down

0 comments on commit a6a8842

Please sign in to comment.