diff --git a/actor/actor_context.go b/actor/actor_context.go index 16babf19..8ff65551 100644 --- a/actor/actor_context.go +++ b/actor/actor_context.go @@ -644,9 +644,10 @@ func (ctx *actorContext) stopAllChildren() { return } - ctx.extras.children.ForEach(func(_ int, pid *PID) { - ctx.Stop(pid) - }) + var pids = ctx.extras.children.pids + for i := len(pids) - 1; i >= 0; i-- { + pids[i].sendSystemMessage(ctx.actorSystem, stopMessage) + } } func (ctx *actorContext) tryRestartOrTerminate() {