From 3671b9f80a286712a0ee6c53d86b619dd6750808 Mon Sep 17 00:00:00 2001 From: Ge Song Date: Wed, 29 Mar 2023 17:45:04 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=20exegroup:=20=E6=8C=89?= =?UTF-8?q?=E7=85=A7=E5=92=8C=E5=90=AF=E5=8A=A8=E7=9B=B8=E5=8F=8D=E7=9A=84?= =?UTF-8?q?=E9=A1=BA=E5=BA=8F=E7=BB=88=E6=AD=A2=20Actor;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- exegroup/group.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/exegroup/group.go b/exegroup/group.go index 1a5ef3f..7af66d3 100644 --- a/exegroup/group.go +++ b/exegroup/group.go @@ -103,7 +103,7 @@ func (g *Group) validate() { } for _, actor := range g.actors { if actor.goFunc == nil { - panic(actor.name + "has nil goFunc") + panic(actor.name + " has nil goFunc") } } } @@ -131,12 +131,12 @@ func (g *Group) wait(c chan error, cancel context.CancelFunc) (err error) { ctx, cancel = context.WithTimeout(context.Background(), g.cfg.stopTimeout) defer cancel() } - for _, m := range g.actors { - if m.stopFunc != nil { + for i := len(g.actors) - 1; i >= 0; i-- { + if g.actors[i].stopFunc != nil { if g.cfg.concurrentStop { - go m.stopFunc(ctx) + go g.actors[i].stopFunc(ctx) } else { - m.stopFunc(ctx) + g.actors[i].stopFunc(ctx) } } }