diff options
author | feistel <6742251-feistel@users.noreply.gitlab.com> | 2021-08-18 18:13:49 +0300 |
---|---|---|
committer | feistel <6742251-feistel@users.noreply.gitlab.com> | 2021-08-18 18:13:49 +0300 |
commit | cf5311514aa603b251226e97fcdc0bf4f2a1a655 (patch) | |
tree | 6c084e448cc676247e7b203c8f8b5a458eca26f6 /internal/source | |
parent | 175480a53dffabf59840e126570a8844fd0047e7 (diff) |
refactor: remove isReady field from gitlab source
assume the gitlab source is always ready
Diffstat (limited to 'internal/source')
-rw-r--r-- | internal/source/gitlab/gitlab.go | 12 | ||||
-rw-r--r-- | internal/source/gitlab/gitlab_test.go | 1 |
2 files changed, 1 insertions, 12 deletions
diff --git a/internal/source/gitlab/gitlab.go b/internal/source/gitlab/gitlab.go index 3a372072..b9291b59 100644 --- a/internal/source/gitlab/gitlab.go +++ b/internal/source/gitlab/gitlab.go @@ -25,7 +25,6 @@ import ( type Gitlab struct { client api.Resolver mu sync.RWMutex - isReady bool enableDisk bool } @@ -41,8 +40,6 @@ func New(cfg *config.GitLab) (*Gitlab, error) { enableDisk: cfg.EnableDisk, } - g.isReady = true - return g, nil } @@ -54,10 +51,6 @@ func (g *Gitlab) GetDomain(ctx context.Context, name string) (*domain.Domain, er if lookup.Error != nil { if errors.Is(lookup.Error, client.ErrUnauthorizedAPI) { log.WithError(lookup.Error).Error("Pages cannot communicate with an instance of the GitLab API. Please sync your gitlab-secrets.json file: https://docs.gitlab.com/ee/administration/pages/#pages-cannot-communicate-with-an-instance-of-the-gitlab-api") - - g.mu.Lock() - g.isReady = false - g.mu.Unlock() } return nil, lookup.Error @@ -122,8 +115,5 @@ func sortLookupsByPrefixLengthDesc(lookups []api.LookupPath) { // 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 + return true } diff --git a/internal/source/gitlab/gitlab_test.go b/internal/source/gitlab/gitlab_test.go index d2a8e267..d1ef2a95 100644 --- a/internal/source/gitlab/gitlab_test.go +++ b/internal/source/gitlab/gitlab_test.go @@ -38,7 +38,6 @@ func TestGetDomain(t *testing.T) { _, err := source.GetDomain(context.Background(), "test") require.EqualError(t, err, client.ErrUnauthorizedAPI.Error()) - require.False(t, source.IsReady()) }) } |