From b94674af6295c2addb4607243246e8be2175ec2a Mon Sep 17 00:00:00 2001 From: Richard Musiol Date: Mon, 8 May 2017 20:39:00 +0200 Subject: [PATCH] fix hang on panic (fixes #82) --- internal/exec/exec.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/exec/exec.go b/internal/exec/exec.go index f529bc24945..b0c6cac85be 100644 --- a/internal/exec/exec.go +++ b/internal/exec/exec.go @@ -72,9 +72,9 @@ func (r *Request) execSelections(ctx context.Context, sels []selected.Selection, wg.Add(len(fields)) for _, f := range fields { go func(f *fieldWithResolver) { + defer wg.Done() defer r.handlePanic(ctx) r.execFieldSelection(ctx, f.field, f.resolver, &f.out, false) - wg.Done() }(f) } wg.Wait() @@ -234,8 +234,8 @@ func (r *Request) execSelectionSet(ctx context.Context, sels []selected.Selectio for i := 0; i < l; i++ { go func(i int) { defer r.handlePanic(ctx) + defer wg.Done() r.execSelectionSet(ctx, sels, t.OfType, resolver.Index(i), &entryouts[i]) - wg.Done() }(i) } wg.Wait()