Skip to content

Commit eb1650c

Browse files
committed
Actor: fix broken callback in pool
1 parent 818cd72 commit eb1650c

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

lib/concurrent/actor/utils/pool.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,7 @@ def on_message(message)
4545
else
4646
Envelope.new(envelope.message, Concurrent.future, envelope.sender, envelope.address)
4747
end
48-
envelope_to_redirect.future.on_completion!(&lambda do |balancer, success, value, reason|
49-
balancer << :subscribe
50-
end.curry[@balancer])
48+
envelope_to_redirect.future.on_completion! { @balancer << :subscribe } # TODO check safety of @balancer reading
5149
redirect @balancer, envelope_to_redirect
5250
end
5351
end

spec/concurrent/actor_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ def on_message(message)
324324
end
325325
end
326326

327-
expect(pool.ask!(5)).to eq 10
327+
10.times { expect(pool.ask!(5)).to eq 10 }
328328
expect(pool.ask(:fail).reason).to be_kind_of RuntimeError
329329
expect(pool.ask!(5)).to eq 10
330330
terminate_actors pool

0 commit comments

Comments
 (0)