From 5ff6cffa080e156bb4f7806c473dafcf6018c6ea Mon Sep 17 00:00:00 2001 From: bigMacro Date: Tue, 25 Jun 2019 16:11:45 +0800 Subject: [PATCH] fix memory visibility error (#1936) Signed-off-by: denghuan --- dispatch/dispatch.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dispatch/dispatch.go b/dispatch/dispatch.go index 2a8c491c..b7bbad9e 100644 --- a/dispatch/dispatch.go +++ b/dispatch/dispatch.go @@ -312,7 +312,9 @@ func newAggrGroup(ctx context.Context, labels model.LabelSet, r *Route, to func( opts: &r.RouteOpts, timeout: to, alerts: store.NewAlerts(15 * time.Minute), + done: make(chan struct{}), } + ag.ctx, ag.cancel = context.WithCancel(ctx) ag.alerts.Run(ag.ctx) @@ -338,8 +340,6 @@ func (ag *aggrGroup) String() string { } func (ag *aggrGroup) run(nf notifyFunc) { - ag.done = make(chan struct{}) - defer close(ag.done) defer ag.next.Stop()