Skip to content

Commit

Permalink
gopls/internal/telemetry: don't schedule the next upload
Browse files Browse the repository at this point in the history
The telemetry upload package implementation queries UploadConfig
only once and reuses it throughout the process lifetime. So, periodic
upload doesn't work. Assume users frequently restart gopls or eventually
we will move the upload logic to go which is frequently invoked, and
run upload only once at the start up.

It's still better to clean up the cached upload config object
after upload is complete.

Fixes golang/go#62405

Change-Id: I39395cf876d9f0e570a71da5284420f570dcdc6b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/524819
TryBot-Result: Gopher Robot <[email protected]>
Run-TryBot: Hyang-Ah Hana Kim <[email protected]>
Reviewed-by: Peter Weinberger <[email protected]>
  • Loading branch information
hyangah committed Sep 1, 2023
1 parent 010e045 commit 77c6ac6
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions gopls/internal/telemetry/telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ package telemetry

import (
"fmt"
"time"

"golang.org/x/telemetry/counter"
"golang.org/x/telemetry/upload"
Expand All @@ -19,14 +18,8 @@ import (
// Start starts telemetry instrumentation.
func Start() {
counter.Open()
go packAndUpload()
}

func packAndUpload() {
start := time.Now()
upload.Run(nil)
elapsed := time.Since(start)
time.AfterFunc(24*time.Hour-elapsed, packAndUpload)
// upload only once at startup, hoping that users restart gopls often.
go upload.Run(nil)
}

// RecordClientInfo records gopls client info.
Expand Down

0 comments on commit 77c6ac6

Please sign in to comment.