You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
require 'concurrent-edge'
class WorkerActor < Concurrent::Actor::RestartingContext
def on_event(event)
puts "#{name} event: #{event.inspect}"
end
end
class Actor < Concurrent::Actor::RestartingContext
def initialize
@worker_pool = Concurrent::Actor::Utils::Pool.spawn('worker_pool', 10) do |index|
WorkerActor.spawn(name: "worker[#{index}]", supervise: true)
end
end
def on_message(message)
puts "#{name} message: #{message.inspect}"
end
def on_event(event)
puts "#{name} event: #{event.inspect}"
end
end
actor = Actor.spawn(name: 'parent')
actor << :terminate!
sleep 0.1
-why does the Actor receive both an event :terminated and a message:terminated? Output from the above:
concurrent-ruby
version: 1.1.5concurrent-ruby-edge
version: 0.5.0Given this code:
-why does the
Actor
receive both an event:terminated
and a message:terminated
? Output from the above:It only seems to receive a message when I use a
Pool
. If I replace the#initialize
method with:Then the output includes only events and no message:
The text was updated successfully, but these errors were encountered: