From 5d84e33be7e31bab85ce998b2565005735decfa4 Mon Sep 17 00:00:00 2001 From: James Shubin Date: Mon, 7 Aug 2023 23:00:50 -0400 Subject: [PATCH] etcd: world: Add missing defer Not sure how this snuck in! I've now ran a quick grep across the code base, and I can't find any similar mistakes. ack '.Done()' | grep -v defer | grep -iv ctx # then check these --- etcd/world.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etcd/world.go b/etcd/world.go index 03eb8336..9ac8e210 100644 --- a/etcd/world.go +++ b/etcd/world.go @@ -76,7 +76,7 @@ func (obj *World) IdealClusterSizeWatch(ctx context.Context) (chan error, error) } util.WgFromCtx(ctx).Add(1) go func() { - util.WgFromCtx(ctx).Done() + defer util.WgFromCtx(ctx).Done() // This must get closed *after* because it will not finish until // the Watcher returns, because it contains a wg.Wait() in it... defer c.Close() // ignore error