diff options
author | Jaime Martinez <jmartinez@gitlab.com> | 2020-07-27 04:13:51 +0300 |
---|---|---|
committer | Jaime Martinez <jmartinez@gitlab.com> | 2020-08-04 09:44:10 +0300 |
commit | 3c58f5f641c8f8dd51358fd812cffeb6491e75cc (patch) | |
tree | a7b260e0c6528cd173833cafe41da50304c6d0a4 /internal/source/gitlab | |
parent | 194bf0568619be8df50a51ed5979a34d4f697b7d (diff) |
Use IsReady instead
Diffstat (limited to 'internal/source/gitlab')
-rw-r--r-- | internal/source/gitlab/gitlab.go | 8 | ||||
-rw-r--r-- | internal/source/gitlab/gitlab_poll.go | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/internal/source/gitlab/gitlab.go b/internal/source/gitlab/gitlab.go index 5bacb603..2635d864 100644 --- a/internal/source/gitlab/gitlab.go +++ b/internal/source/gitlab/gitlab.go @@ -104,3 +104,11 @@ func (g *Gitlab) Resolve(r *http.Request) (*serving.Request, error) { return &serving.Request{Serving: defaultServing()}, errors.New("could not match lookup path") } + +// IsReady returns the value of Gitlab `isReady` which is updated by `Poll`. +func (g *Gitlab) IsReady() bool { + g.mu.RLock() + defer g.mu.RUnlock() + + return g.isReady +} diff --git a/internal/source/gitlab/gitlab_poll.go b/internal/source/gitlab/gitlab_poll.go index 70644822..9fce7250 100644 --- a/internal/source/gitlab/gitlab_poll.go +++ b/internal/source/gitlab/gitlab_poll.go @@ -15,6 +15,7 @@ const ( // poll tries to call the /internal/pages/status API endpoint once plus // `retries` every `interval`. +// It updates the `isReady` value when successful. // TODO: Remove in https://gitlab.com/gitlab-org/gitlab/-/issues/218357 func (g *Gitlab) poll(retries int, interval time.Duration) { var err error |