diff options
| author | Jonathan Amsterdam <jba@google.com> | 2019-09-20 23:23:17 -0400 |
|---|---|---|
| committer | Julie Qiu <julie@golang.org> | 2020-03-27 16:46:43 -0400 |
| commit | fffe8a461e38e0952b24bd2433e341492b90c442 (patch) | |
| tree | 2b4a49f523ff5b8582bfb42a8193d00396c26894 /internal/postgres/postgres.go | |
| parent | c2b3cb41c0cacb3dcfafc426a676e9f0543650d9 (diff) | |
| download | go-x-pkgsite-fffe8a461e38e0952b24bd2433e341492b90c442.tar.xz | |
internal/postgres: take low-order part of instanceID
bugfix: take the end of the instance ID, which is random; not the beginning,
which seems fixed.
Also, given that we only have a handful of instances, 4 characters should suffice.
Change-Id: Ibc80f65e335fa2f3ebeb39322f85cb1a1a07a60e
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/556716
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Diffstat (limited to 'internal/postgres/postgres.go')
| -rw-r--r-- | internal/postgres/postgres.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/internal/postgres/postgres.go b/internal/postgres/postgres.go index 23d730a0..cd9673dd 100644 --- a/internal/postgres/postgres.go +++ b/internal/postgres/postgres.go @@ -72,7 +72,7 @@ func logQuery(query string, args []interface{}) func(*error) { } else { // Instance IDs are long strings. The low-order part seems quite random, so // shortening the ID will still likely result in something unique. - instanceID = instanceID[:8] + instanceID = instanceID[len(instanceID)-4:] } n := atomic.AddInt64(&queryCounter, 1) uid := fmt.Sprintf("%s-%d", instanceID, n) |
