Skip to content

Commit 77c6ac6

Browse files
committed
gopls/internal/telemetry: don't schedule the next upload
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 <gobot@golang.org> Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com> Reviewed-by: Peter Weinberger <pjw@google.com>
1 parent 010e045 commit 77c6ac6

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

gopls/internal/telemetry/telemetry.go

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ package telemetry
99

1010
import (
1111
"fmt"
12-
"time"
1312

1413
"golang.org/x/telemetry/counter"
1514
"golang.org/x/telemetry/upload"
@@ -19,14 +18,8 @@ import (
1918
// Start starts telemetry instrumentation.
2019
func Start() {
2120
counter.Open()
22-
go packAndUpload()
23-
}
24-
25-
func packAndUpload() {
26-
start := time.Now()
27-
upload.Run(nil)
28-
elapsed := time.Since(start)
29-
time.AfterFunc(24*time.Hour-elapsed, packAndUpload)
21+
// upload only once at startup, hoping that users restart gopls often.
22+
go upload.Run(nil)
3023
}
3124

3225
// RecordClientInfo records gopls client info.

0 commit comments

Comments
 (0)