diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-02 18:10:48 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-02 18:10:48 +0300 |
commit | 3a52eefc27143af8a2b3838a159c52484ca4bc8b (patch) | |
tree | bb93b151f3bb91b300e4ee7fde249f324a0d5f9c /workhorse/internal/upstream | |
parent | 02e597943fcd131d51b63bfa20a17cf8438adde2 (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 2031fa84ce2..c685f82c388 100644 --- a/workhorse/internal/upstream/upstream_test.go +++ b/workhorse/internal/upstream/upstream_test.go @@ -314,5 +314,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 } |