From d5e01df56f2872149c4be3c306637c9a8f6cbe88 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Fri, 2 Jul 2021 10:50:07 +0100 Subject: [PATCH] Fix waitgroup --- federationapi/routing/send.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/federationapi/routing/send.go b/federationapi/routing/send.go index b7341dd32..25822f8be 100644 --- a/federationapi/routing/send.go +++ b/federationapi/routing/send.go @@ -210,6 +210,8 @@ func (t *txnReq) processTransaction(ctx context.Context) (*gomatrixserverlib.Res //var resultsMutex sync.Mutex var wg sync.WaitGroup + wg.Add(1) // for processEDUs + for _, pdu := range t.PDUs { pduCountTotal.WithLabelValues("total").Inc() var header struct { @@ -276,8 +278,6 @@ func (t *txnReq) processTransaction(ctx context.Context) (*gomatrixserverlib.Res }) } - wg.Wait() - go func() { defer wg.Done() t.processEDUs(ctx)