Skip to content

Commit

Permalink
consistency in naming
Browse files Browse the repository at this point in the history
  • Loading branch information
ph committed May 16, 2017
1 parent 23d0b34 commit c970022
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions logstash-core/spec/logstash/instrument/wrapped_write_client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
require "spec_helper"

describe LogStash::Instrument::WrappedWriteClient do
let(:write_client) { queue.write_client }
let(:read_client) { queue.read_client }
let!(:write_client) { queue.write_client }
let!(:read_client) { queue.read_client }
let(:pipeline) { double("pipeline", :pipeline_id => :main) }
let(:collector) { LogStash::Instrument::Collector.new }
let(:metric) { LogStash::Instrument::Metric.new(collector) }
Expand All @@ -18,16 +18,16 @@

subject { described_class.new(write_client, pipeline, metric, plugin) }

def threaded_read_client(read_client)
Thread.new(read_client) do |_read_client|
def threaded_read_client
Thread.new do
started_at = Time.now

batch_size = 0
loop {
if Time.now - started_at > 60
raise "Took too much time to read from the queue"
end
batch_size = _read_client.read_batch.size
batch_size = read_client.read_batch.size

break if batch_size > 0
}
Expand All @@ -38,10 +38,10 @@ def threaded_read_client(read_client)
shared_examples "queue tests" do
it "pushes single event to the `WriteClient`" do
pusher_thread = Thread.new(subject, event) do |_subject, _event|
_subject.push(event)
_subject.push(_event)
end

reader_thread = threaded_read_client(read_client)
reader_thread = threaded_read_client

[pusher_thread, reader_thread].collect(&:join)
end
Expand All @@ -51,20 +51,20 @@ def threaded_read_client(read_client)
batch << event

pusher_thread = Thread.new(subject, batch) do |_subject, _batch|
subject.push_batch(_batch)
_subject.push_batch(_batch)
end

reader_thread = threaded_read_client(read_client)
reader_thread = threaded_read_client
[pusher_thread, reader_thread].collect(&:join)
end

context "recorded metrics" do
before do
pusher_thread = Thread.new(subject, event) do |_subject, _event|
_subject.push(event)
_subject.push(_event)
end

reader_thread = threaded_read_client(read_client)
reader_thread = threaded_read_client
[pusher_thread, reader_thread].collect(&:join)
end

Expand Down

0 comments on commit c970022

Please sign in to comment.