diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 15:13:46 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 15:13:46 +0300 |
commit | 9796aa22cd601f03101402540f41a05ad71828e5 (patch) | |
tree | af5934ea6156c4b31fd67bb7f5bd3a3de86b35fd /workhorse/internal/upstream | |
parent | f7e83434e312ca6cf598c6d815fe32dc200e3056 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'workhorse/internal/upstream')
-rw-r--r-- | workhorse/internal/upstream/upstream.go | 4 | ||||
-rw-r--r-- | workhorse/internal/upstream/upstream_test.go | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/workhorse/internal/upstream/upstream.go b/workhorse/internal/upstream/upstream.go index e57f58d59dd..6835569dfa8 100644 --- a/workhorse/internal/upstream/upstream.go +++ b/workhorse/internal/upstream/upstream.go @@ -65,7 +65,7 @@ func newUpstream(cfg config.Config, accessLogger *logrus.Logger, routesCallback Config: cfg, accessLogger: accessLogger, // Kind of a feature flag. See https://gitlab.com/groups/gitlab-org/-/epics/5914#note_564974130 - enableGeoProxyFeature: os.Getenv("GEO_SECONDARY_PROXY") == "1", + enableGeoProxyFeature: os.Getenv("GEO_SECONDARY_PROXY") != "0", geoProxyBackend: &url.URL{}, } if up.geoProxyPollSleep == nil { @@ -207,8 +207,8 @@ func (u *upstream) findGeoProxyRoute(cleanedPath string, r *http.Request) *route func (u *upstream) pollGeoProxyAPI() { for { - u.callGeoProxyAPI() u.geoProxyPollSleep(geoProxyApiPollingInterval) + u.callGeoProxyAPI() } } diff --git a/workhorse/internal/upstream/upstream_test.go b/workhorse/internal/upstream/upstream_test.go index 53c15bb7e91..4d8efed2b73 100644 --- a/workhorse/internal/upstream/upstream_test.go +++ b/workhorse/internal/upstream/upstream_test.go @@ -310,5 +310,9 @@ func startWorkhorseServer(railsServerURL string, enableGeoProxyFeature bool) (*h } } + // Since the first sleep happens before any API call, this ensures + // we call the API at least once. + waitForNextApiPoll() + return ws, ws.Close, waitForNextApiPoll } |