aboutsummaryrefslogtreecommitdiff
path: root/internal/queue/queue.go
diff options
context:
space:
mode:
authorJonathan Amsterdam <jba@google.com>2020-12-16 16:53:37 -0500
committerJonathan Amsterdam <jba@google.com>2020-12-21 18:26:01 +0000
commit912ce69a64aa84511af7cef997fc3e336810b587 (patch)
treea45a2dd7715a734ac1c05d455f29d0a041420e49 /internal/queue/queue.go
parent37823d878d455c0e18480968d7f8fe3ddf4c4943 (diff)
downloadgo-x-pkgsite-912ce69a64aa84511af7cef997fc3e336810b587.tar.xz
internal/worker: honor proxyfetch query param
If the fetch handler sees the "proxyfetch" query param set to "off", it tells internal/fetch to disable fetching by the proxy. Change-Id: I1c9303f96f9249a5b420a73451551aba21d9d417 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/278953 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org>
Diffstat (limited to 'internal/queue/queue.go')
-rw-r--r--internal/queue/queue.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/internal/queue/queue.go b/internal/queue/queue.go
index 03578d12..5890b11d 100644
--- a/internal/queue/queue.go
+++ b/internal/queue/queue.go
@@ -137,11 +137,16 @@ func (q *GCP) ScheduleFetch(ctx context.Context, modulePath, version, suffix str
// See https://cloud.google.com/tasks/docs/creating-http-target-tasks.
const maxCloudTasksTimeout = 30 * time.Minute
+const (
+ DisableProxyFetchParam = "proxyfetch"
+ DisableProxyFetchValue = "off"
+)
+
func (q *GCP) newTaskRequest(modulePath, version, suffix string, disableProxyFetch bool) *taskspb.CreateTaskRequest {
taskID := newTaskID(modulePath, version)
relativeURI := fmt.Sprintf("/fetch/%s/@v/%s", modulePath, version)
if disableProxyFetch {
- relativeURI += "?proxyfetch=off"
+ relativeURI += fmt.Sprintf("?%s=%s", DisableProxyFetchParam, DisableProxyFetchValue)
}
task := &taskspb.Task{
Name: fmt.Sprintf("%s/tasks/%s", q.queueName, taskID),