Skip to content

Commit 757e691

Browse files
committed
nxy
1 parent 31a3346 commit 757e691

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

Diff for: spec/filewatch/rotate_spec.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -193,19 +193,19 @@ module FileWatch
193193
let(:listener2) { observer.listener_for(second_file.to_path) }
194194
let(:actions) do
195195
RSpec::Sequencing
196-
.run_after(0.25, "create original - write line 1, 66 bytes") do
196+
.run_after(0.75, "create original - write line 1, 66 bytes") do
197197
file_path.open("wb") { |file| file.write("#{line1}\n") }
198198
end
199-
.then_after(0.25, "rename to 2.log") do
199+
.then_after(0.75, "rename to 2.log") do
200200
file_path.rename(second_file)
201201
file_path.open("wb") { |file| file.write("#{line2}\n") }
202202
end
203-
.then_after(0.25, "rename to 2.log again") do
203+
.then_after(0.75, "rename to 2.log again") do
204204
file_path.rename(second_file)
205205
file_path.open("wb") { |file| file.write("#{line3}\n") }
206206
end
207207
.then("wait for expectations to be met") do
208-
wait(0.5).for{listener1.lines.size == 3 && listener2.lines.empty?}.to eq(true)
208+
wait(1).for{listener1.lines.size == 3 && listener2.lines.empty?}.to eq(true)
209209
end
210210
.then("quit") do
211211
tailing.quit

Diff for: spec/filewatch/tailing_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ module FileWatch
482482
tailing.watch_this(watch_dir)
483483
end
484484
.then("wait for lines") do
485-
wait(1.5).for{listener1.calls}.to eq([:open, :accept, :accept, :timed_out])
485+
wait(2.5).for{listener1.calls}.to eq([:open, :accept, :accept, :timed_out])
486486
end
487487
.then("quit") do
488488
tailing.quit

Diff for: spec/inputs/file_read_spec.rb

+8-2
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@
350350

351351
private
352352

353-
def wait_for_start_processing(run_thread, timeout: 1.0)
353+
def wait_for_start_processing(run_thread, timeout: 5.0)
354354
begin
355355
Timeout.timeout(timeout) do
356356
# sleep(0.01) while run_thread.status != 'sleep'
@@ -363,7 +363,13 @@ def wait_for_start_processing(run_thread, timeout: 1.0)
363363
sleep(0.1)
364364
puts "no queue"
365365
end
366-
end
366+
puts "the queue size is #{plugin.queue.size}"
367+
# sleep(0.1) while !plugin.queue
368+
while plugin.queue.size == 0
369+
sleep(0.1)
370+
puts "no item on queue"
371+
end
372+
end
367373
rescue Timeout::Error => e
368374
puts "plugin timed out #{e}"
369375
raise "plugin did not start processing (timeout: #{timeout})" unless plugin.queue

0 commit comments

Comments
 (0)