aboutsummaryrefslogtreecommitdiff
path: root/internal/worker/refetch_test.go
diff options
context:
space:
mode:
authorJonathan Amsterdam <jba@google.com>2021-04-21 06:47:39 -0400
committerJonathan Amsterdam <jba@google.com>2021-04-29 21:01:19 +0000
commiteac14482e2f038cb8bcb9c68ee7a5784d1b0a188 (patch)
tree00ab76f4f9cb7c8605ad5a94176655e3f5cf3c9f /internal/worker/refetch_test.go
parent0d8ca9e10e1265bee15a85924983cd40dd751040 (diff)
downloadgo-x-pkgsite-eac14482e2f038cb8bcb9c68ee7a5784d1b0a188.tar.xz
internal/postgres: read only one doc source from DB
If GetUnit is passed a build context, it will read documentation source only for that build context. It still reads all the build context values, just only one serialized blob of file ASTs. This sped up getUnitWithAllFields by about 2x on net/http, using detail-stats against the staging DB from a local frontend. Change-Id: Ib8e988940b7f8f8ef2c270129c4338bb3d56b9eb Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/312269 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org>
Diffstat (limited to 'internal/worker/refetch_test.go')
-rw-r--r--internal/worker/refetch_test.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/internal/worker/refetch_test.go b/internal/worker/refetch_test.go
index 0b746dcd..5f9e2944 100644
--- a/internal/worker/refetch_test.go
+++ b/internal/worker/refetch_test.go
@@ -129,13 +129,13 @@ func TestReFetch(t *testing.T) {
t.Fatalf("testDB.GetUnitMeta(ctx, %q, %q) mismatch (-want +got):\n%s", want.ModulePath, want.Version, diff)
}
- gotPkg, err := testDB.GetUnit(ctx, got, internal.WithMain)
+ gotPkg, err := testDB.GetUnit(ctx, got, internal.WithMain, internal.BuildContext{})
if err != nil {
t.Fatal(err)
}
if diff := cmp.Diff(want, gotPkg,
cmp.AllowUnexported(source.Info{}),
- cmpopts.IgnoreFields(internal.Unit{}, "Documentation"),
+ cmpopts.IgnoreFields(internal.Unit{}, "Documentation", "BuildContexts"),
cmpopts.IgnoreFields(licenses.Metadata{}, "Coverage", "OldCoverage"),
cmpopts.IgnoreFields(internal.UnitMeta{}, "HasGoMod")); diff != "" {
t.Errorf("mismatch on readme (-want +got):\n%s", diff)