Skip to content

Commit 8ad788d

Browse files
committed
Fix spec timing
1 parent a423377 commit 8ad788d

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

spec/concurrent/delay_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def dereferenceable_subject(value, opts = {})
2222
let!(:rejected_reason) { StandardError.new('mojo jojo') }
2323

2424
let(:pending_subject) do
25-
Delay.new(executor: :fast){ sleep 0.05; fulfilled_value }
25+
Delay.new(executor: :fast){ sleep 0.1; fulfilled_value }
2626
end
2727

2828
let(:fulfilled_subject) do

spec/concurrent/edge/erlang_actor_spec.rb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -917,17 +917,19 @@
917917
end
918918

919919
specify "timing out" do
920-
body = { on_thread: -> { m = receive; sleep 0.01; reply m },
921-
on_pool: -> { receive { |m| sleep 0.01; reply m } } }
920+
count_down = Concurrent::CountDownLatch.new
921+
body = { on_thread: -> { m = receive; count_down.wait; reply m },
922+
on_pool: -> { receive { |m| count_down.wait; reply m } } }
922923
a = Concurrent::ErlangActor.spawn(type: type, &body.fetch(type))
923924
expect(a.ask(:err, 0, 42)).to eq 42
925+
count_down.count_down
924926
expect(a.terminated.value!).to eq false
925927

926928
body = { on_thread: -> { reply receive },
927929
on_pool: -> { receive { |m| reply m } } }
928-
a = Concurrent::ErlangActor.spawn(type: type, &body.fetch(type))
929-
expect(a.ask(:v, 1, 42)).to eq :v
930-
expect(a.terminated.value!).to eq true
930+
b = Concurrent::ErlangActor.spawn(type: type, &body.fetch(type))
931+
expect(b.ask(:v, 1, 42)).to eq :v
932+
expect(b.terminated.value!).to eq true
931933
end
932934

933935
specify "rejects on no reply" do

0 commit comments

Comments
 (0)