Actor pool terminated event sent as message
@pitr-ch ci sta già lavorando.
Dal 24/8/2019.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
- Operating system: Linux
- Ruby implementation: Ruby
concurrent-rubyversion: 1.1.5concurrent-ruby-edgeversion: 0.5.0
Given this code:
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:
parent event: [:terminated, nil]
worker[0] event: [:terminated, nil]
worker[1] event: [:terminated, nil]
worker[2] event: [:terminated, nil]
worker[3] event: [:terminated, nil]
worker[4] event: [:terminated, nil]
worker[5] event: [:terminated, nil]
worker[6] event: [:terminated, nil]
worker[7] event: [:terminated, nil]
worker[8] event: [:terminated, nil]
worker[9] event: [:terminated, nil]
parent message: [:terminated, nil]
It only seems to receive a message when I use a Pool. If I replace the #initialize method with:
@worker = WorkerActor.spawn(name: 'worker', supervise: true)
Then the output includes only events and no message:
parent event: [:terminated, nil]
worker event: [:terminated, nil]
- Lingua principale
- Ruby
- Stelle
- 5.8k
- Fork
- 420
- Merge medio
- 20h 45m
- PR unite (30g)
- 4
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di ruby-concurrency/concurrent-ruby
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
ruby-concurrency/concurrent-ruby#1118 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
ruby-concurrency/concurrent-ruby#1099 · 9 commenti ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
ruby-concurrency/concurrent-ruby#1095 · 8 commenti ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
ruby-concurrency/concurrent-ruby#1093 · 3 commenti ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 45/100
ruby-concurrency/concurrent-ruby#1091 ·
Tutte le issue di ruby-concurrency/concurrent-ruby
Issue simili
-
バグ
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
-
Version bump for OpenVox 9 Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
voxpupuli/puppet-epel#186 · 1 commento ·
-
external_created_at is no longer used for the message timestamp since the new message UI (v4.4.0) ApertaBug Frontend
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
TheOdinProject/curriculum#31402 · 1 commento ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100