diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2019-11-14 14:58:49 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2019-11-14 14:58:49 +0300 |
commit | d72bbda34c0e7453337fea9add9276a7fabb4a96 (patch) | |
tree | 240467c5b7ef54186fafba4d993de494784a4f8c /internal/source/gitlab/cache/entry.go | |
parent | 4621a44e1b7a2afa9ccb7f6bd1a0aec7f0215b4d (diff) |
Fix unreachable code in gitlab source entry type
Diffstat (limited to 'internal/source/gitlab/cache/entry.go')
-rw-r--r-- | internal/source/gitlab/cache/entry.go | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/internal/source/gitlab/cache/entry.go b/internal/source/gitlab/cache/entry.go index 67a1a03a..0d1c0ef9 100644 --- a/internal/source/gitlab/cache/entry.go +++ b/internal/source/gitlab/cache/entry.go @@ -63,7 +63,7 @@ func (e *Entry) Lookup() *Lookup { } // Retrieve perform a blocking retrieval of the cache entry response. -func (e *Entry) Retrieve(ctx context.Context, client Resolver) *Lookup { +func (e *Entry) Retrieve(ctx context.Context, client Resolver) (lookup *Lookup) { newctx, cancelctx := context.WithTimeout(ctx, retrievalTimeout) defer cancelctx() @@ -71,13 +71,12 @@ func (e *Entry) Retrieve(ctx context.Context, client Resolver) *Lookup { select { case <-newctx.Done(): - return &Lookup{Status: 502, Error: errors.New("context done")} + lookup = &Lookup{Status: 502, Error: errors.New("context done")} case <-e.retrieved: - return e.Lookup() + lookup = e.Lookup() } - // This should not happen - return &Lookup{Status: 500, Error: errors.New("retrieval error")} + return lookup } // Refresh will update the entry in the store only when it gets resolved. |