diff options
author | Vladimir Shushlin <vshushlin@gitlab.com> | 2022-02-10 19:09:53 +0300 |
---|---|---|
committer | Vladimir Shushlin <vshushlin@gitlab.com> | 2022-02-10 19:09:53 +0300 |
commit | ae8fbc5bf6725e6fa5b5a9dec6e4ac5016ec3c6c (patch) | |
tree | f62967094ef93f86abdd35389cd5bcd9b4249523 | |
parent | 4be18c70ba9ddc62237dcf0a534c57540829cc9e (diff) | |
parent | 970531c7f80db47d209196921043aabcdf7590ef (diff) |
Merge branch 'fix/retriever-leak' into 'master'
fix: do no retry resolving the domain if there's a ctx error
See merge request gitlab-org/gitlab-pages!691
-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) } |