diff options
author | feistel <6742251-feistel@users.noreply.gitlab.com> | 2022-02-10 01:38:53 +0300 |
---|---|---|
committer | feistel <6742251-feistel@users.noreply.gitlab.com> | 2022-02-10 15:05:29 +0300 |
commit | 970531c7f80db47d209196921043aabcdf7590ef (patch) | |
tree | 267d9516d6a1cce4a51da92e11f30d3ac84458cd /internal | |
parent | f125379b7e8fc6955d1c7cb2d686862e44628bff (diff) |
fix: do no retry resolving the domain if there's a ctx error
during a ctx error the retriever was leaking the goroutine leading to
the same error on each try and keeping around the goroutine more than
retrieverTimeout.
Changelog: fixed
Diffstat (limited to 'internal')
-rw-r--r-- | internal/source/gitlab/cache/retriever.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/internal/source/gitlab/cache/retriever.go b/internal/source/gitlab/cache/retriever.go index 65c7f1a2..68299f6c 100644 --- a/internal/source/gitlab/cache/retriever.go +++ b/internal/source/gitlab/cache/retriever.go @@ -78,6 +78,11 @@ func (r *Retriever) resolveWithBackoff(ctx context.Context, domainName string) < break } + if errors.Is(lookup.Error, context.Canceled) || errors.Is(lookup.Error, context.DeadlineExceeded) { + // do not retry if there's a context error to avoid leaking the goroutine + break + } + time.Sleep(r.maxRetrievalInterval) } |