From 7233e957747184c3885325c521a4d46f558c962e Mon Sep 17 00:00:00 2001 From: Umputun Date: Wed, 14 Nov 2018 11:08:25 -0600 Subject: [PATCH] restore goroutine in notify non-blocking send --- backend/app/notify/notify.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/backend/app/notify/notify.go b/backend/app/notify/notify.go index f8f75859..7aa5defd 100644 --- a/backend/app/notify/notify.go +++ b/backend/app/notify/notify.go @@ -89,12 +89,14 @@ func (s *Service) Close() { func (s *Service) do() { for c := range s.queue { var wg sync.WaitGroup + wg.Add(len(s.destinations)) for _, dest := range s.destinations { - wg.Add(1) - if err := dest.Send(s.ctx, c); err != nil { - log.Printf("[WARN] failed to send to %s, %s", dest, err) - } - wg.Done() + go func(d Destination) { + if err := d.Send(s.ctx, c); err != nil { + log.Printf("[WARN] failed to send to %s, %s", d, err) + } + wg.Done() + }(dest) } wg.Wait() }