aboutsummaryrefslogtreecommitdiff
path: root/internal/postgres/postgres.go
diff options
context:
space:
mode:
authorJonathan Amsterdam <jba@google.com>2019-09-20 23:23:17 -0400
committerJulie Qiu <julie@golang.org>2020-03-27 16:46:43 -0400
commitfffe8a461e38e0952b24bd2433e341492b90c442 (patch)
tree2b4a49f523ff5b8582bfb42a8193d00396c26894 /internal/postgres/postgres.go
parentc2b3cb41c0cacb3dcfafc426a676e9f0543650d9 (diff)
downloadgo-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.go2
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)