From e643ce5b99002ef70152a46e989bc0e7c9558431 Mon Sep 17 00:00:00 2001 From: Quentin McGaw Date: Tue, 29 Dec 2020 16:44:55 +0000 Subject: [PATCH] Fix publicip and updater loops exit bugs --- internal/publicip/loop.go | 4 +++- internal/updater/loop.go | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/publicip/loop.go b/internal/publicip/loop.go index 69caaf9d..b803be35 100644 --- a/internal/publicip/loop.go +++ b/internal/publicip/loop.go @@ -104,7 +104,9 @@ func (l *looper) Run(ctx context.Context, wg *sync.WaitGroup) { go func() { ip, err := l.getter.Get(getCtx) if err != nil { - errorCh <- err + if getCtx.Err() == nil { + errorCh <- err + } return } ipCh <- ip diff --git a/internal/updater/loop.go b/internal/updater/loop.go index 33ce14f0..70040714 100644 --- a/internal/updater/loop.go +++ b/internal/updater/loop.go @@ -96,7 +96,9 @@ func (l *looper) Run(ctx context.Context, wg *sync.WaitGroup) { go func() { servers, err := l.updater.UpdateServers(updateCtx) if err != nil { - errorCh <- err + if updateCtx.Err() == nil { + errorCh <- err + } return } serversCh <- servers