Watch in the wrong place

This commit is contained in:
Johan Andrén 2019-10-31 10:28:16 +01:00
parent 6d722cc313
commit a2329e7c8e

View file

@ -49,10 +49,10 @@ object TypedSample {
children.get(name) match {
case Some(ref) =>
ref ! childCommand
context.watchWith(ref, ChildTerminated(name))
Behaviors.same
case None =>
val ref = context.spawn(Child(), name)
context.watchWith(ref, ChildTerminated(name))
ref ! childCommand
updated(children + (name -> ref))
}