aboutsummaryrefslogtreecommitdiff
path: root/internal/postgres/path.go
diff options
context:
space:
mode:
authorJonathan Amsterdam <jba@google.com>2021-06-09 12:15:08 -0400
committerJonathan Amsterdam <jba@google.com>2021-06-10 10:49:42 +0000
commitd1a6ef5b2513da3f2f3461edade0d8a6059015ee (patch)
tree3ee6ef98c94f5c92695acbafb3114d9993ff25e1 /internal/postgres/path.go
parentdf4f05dc595ce7d8480f232e3174a8adb421d441 (diff)
downloadgo-x-pkgsite-d1a6ef5b2513da3f2f3461edade0d8a6059015ee.tar.xz
internal/postgres: write to imports table
Write a package's import paths to the new imports table as well as the existing package_imports table. Change-Id: Ie0afe5aa90e79e8371a51cc6fc5f68de3dc62cd8 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/326449 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> Reviewed-by: Julie Qiu <julie@golang.org>
Diffstat (limited to 'internal/postgres/path.go')
-rw-r--r--internal/postgres/path.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/internal/postgres/path.go b/internal/postgres/path.go
index b379a9bb..cf106cad 100644
--- a/internal/postgres/path.go
+++ b/internal/postgres/path.go
@@ -113,6 +113,9 @@ func upsertPath(ctx context.Context, tx *database.DB, path string) (id int, err
func upsertPaths(ctx context.Context, db *database.DB, paths []string) (pathToID map[string]int, err error) {
defer derrors.WrapStack(&err, "upsertPaths(%d paths)", len(paths))
+ // Read all existing paths for this module, to avoid a large bulk upsert.
+ // (We've seen these bulk upserts hang for so long that they time out (10
+ // minutes)).
pathToID = map[string]int{}
collect := func(rows *sql.Rows) error {
var (